Polish strips metadata and applies lossy or lossless compression. Polish accelerates image downloads by reducing image size. Learn more about Polish from our blog post.
Polish Compression Options
This option strips metadata, e.g. EXIF data, but doesn't change the image detail. Effectively, when uncompressed, a lossless image is identical to the original.
This option strips metadata and compresses images by approximately 15 percent. When uncompressed, some of the redundant information from the original image is lost.
Lossy has the same effect as Lossless when applied to PNG.
WebP is a modern image format providing superior lossless and lossy compression for images. WebP lossless images are approximately 26 percent smaller than PNGs, while lossy images are 25 to 34 percent smaller than JPEGs.
Polish creates and caches a WebP version of the image and delivers it to the browser if the Accept header from the browser includes WebP and the compressed image is significantly smaller than the lossy or lossless compression.
Currently, WebP is only supported in Firefox, Google Chrome, and Opera. You can find out more in our blog post.
Images in the cache must be purged or expired before seeing any changes in Polish settings.
Update Polish settings via the speed app:
- Log in to the Cloudflare dashboard.
- Click the appropriate Cloudflare account for the domain where you will activate Polish.
- Ensure the proper domain is selected.
- Click on the Cloudflare Speed app.
- Scroll down to Polish.
- Select lossy or lossless from the Polish dropdown menu.
- (Optional) Click WebP. By applying WebP, Cloudflare can further optimize .png and .jpeg images stored in the origin server.
Verify Polish is active
Polish adds two headers to image requests that are compressed:
cf-bgj: imgq:85 cf-polished: qual=85, origFmt=jpeg, origSize=95005 cf-cache-status: HIT
The cf-bgj header confirms that Cloudflare applied Polish and returns the image quality setting (imgq). The cf-polished header represents the Polish status and returns the image quality setting (qual) and original size (origSize). The cf-cache-status confirms that the image has been cached and Polish can be applied.
WebP conversion does not change the image URL. The Content-Type HTTP header tells the browser the true format of an image.
Common Cf-Polished statuses
Below is a list of common Cf-Polished statuses and how to troubleshoot them. If no Cf-Polished header is returned, try using single-file cache purge to purge the image.
input_too_large: The input image is too large or complex to process and needs a lower resolution. We recommend using .png or .jpeg images that are less than 1,000px and 10MB.
not_compressed or not_needed: The image was fully optimized at the origin server and no compression was applied.
webp_bigger: Polish attempted to convert to WebP, but the image was optimized at the origin server and/or was created using a low quality setting. Because the WebP version doesn’t exist, the status is set on the JPEG/PNG version of the response.
cannot_optimize or internal_error: The input image is corrupted or incomplete at the origin server. Upload a new version of the image to the origin server.
format_not_supported: The input image format is not supported (e.g. BMP, TIFF) and/or the origin server is using additional optimization software that is not compatible with Polish.
Try converting the input image to a web-compatible format (e.g. PNG, JPEG) and/or disabling additional optimization software at the origin server.