3

When I test my site on Google's PageSpeed Insights, it reports that some of the images should be optimized by converting them to .webp or .avif format. However, I am already using the Cloudflare Polish product across my site which is supposed to automatically serve my images in the .webp format, so what gives? Why am I still getting this recommendation/condemnation from Google?

1 Answer 1

5

The answer lies in the fact that Google uses a different image file converter than Cloudflare does.

Cloudflare Polish will not convert any image which it decides will be larger after the conversion.

In my case, I took a .png image which, according to PageSpeed Insights, should be converted to the .webp format for bandwith optimization. When I ran it through CloudConvert's image converter manually, the .png was 38KB compared to 29KB for the .webp image.

However, when running the image through Cloudflare Polish's system...

curl -sIL URL/to/image/name.png -H "accept: image/webp"

Part of the resulting header:

cf-polished: origSize=39783, status=webp_bigger 

The image was marked as larger after going through conversion, presumably because the conversion system is slightly different than Google's, so Cloudflare Polish will leave the image as a .png.

EDIT: Cloudflare also will not convert an image to .webp if the conversion would take longer than the time that would be saved by being smaller (in its opinion, based on various factors). So it optimizes for speed rather than bandwidth.[1] This could also cause the image not to be converted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.