Using Polish to compress images on Cloudflare

What is Polish?

Polish is an image compression system that we originally released in 2012. It works by stripping meta-data and then applying lossy or lossless compression. This is done to reduce the size of the images being delivered to browsers and therefore speed the download of these objects by the clients. You can find out more about how it works in our original blog post.

kangaroos.png.scaled500.png

 What are the modes or options? 

Lossless

  • Only strips metadata, e.g. EXIF data, but doesn't change the image

Lossy

  • Strips metadata and Compresses image to ~"85%"

WebP

  • Creates and caches a WebP version of the file and delivers that to the browser if the accept header from the browser includes WebP. You can find out more in our Blog Post.

Example Accept header for WebP: 

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8

How can I tell if an image has been optimized by Polish? 

Polish adds two headers to image requests that are compressed. 

Cf-Bgj: imgq:85
Cf-Polished: qual=85, origFmt=jpeg, origSize=95005

Note that WebP conversion does not change the URLs of images. The “Content-Type” HTTP header tells the browser the true format of an image.

How can I see changes after enabling or changing a Polish setting? 

Polish optimizes the cached version of a resource so cache must be purged or expired before seeing changes in Polish setting.

You can enable and change Polish settings in the speed tab:

polish-webp.png

Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.

Powered by Zendesk