Image Optimization & Webp
Scott avatar
Written by Scott
Updated over a week ago


Now that I have Cloudflare Enterprise, how does its Image Optimization feature actually work?

The way the image optimization works with Cloudflare is, the files themselves on the server are not touched, they remain as they are. Once one of your pages are visited, that page is cached, when the page is cached so is all your static content like images, js, css, etc. A further step is taken during this caching process, now when the images are cached they are also optimized. The image size is reduced as much as possible while ensuring the quality remain the same.


What about serving my images in Webp format?

Cloudflare will also try and use webp format IF it's the smallest file size. In some cases, the webp version of the image is actually larger than the original or the optimized version so its not served. Google is more then aware of this as well as you can read about it here:


https://developers.google.com/speed/webp/faq#can_a_webp_image_grow_larger_than_its_source_image

To give you an idea, when I look at your homepage:

https://i.imgur.com/GJmZqIt.png

You can see all images are being served in webp format except for 2.

Cloudflare is helpful in which it will actually give you a reason if you inspect the image headers:

https://i.imgur.com/GAbx4Fl.png

In the case for that image, you can see the webp version was actually larger so Cloudflare doesn't use that version since it would be taking away from the optimization.

Lastly, for the static 'Serve static assets with an efficient cache policy' we set this properly on the server. In the situations where Google is still complaining it means its referring to external content which we cannot control, external content meaning some content not hosted by your domain:

https://i.imgur.com/T6xgkCD.png

You'll notice all the ones surrounded in red are NOT from your domain so we cannot adjust those headers.

If you ever notice some content is from your domain, please reach out to support so we can check it further and apply any necessary changes.

Did this answer your question?