Image resize worker is producing large images

I’m trying to set up my own little image optimization service, using a Cloudflare image resizing worker, as described at

The sizes of resulting images don’t look so good. I wonder if there is anything I’m missing.

For example, testing on this image:
The original image dimensions are 1000 × 667
The original file size is 212K

Here is what we get from Cloudflare when resizing to a width of 875, at different quality levels.
I also added a comparison to Vercel’s image optimization:

| quality | avif | jpeg | webp | webp on Vercel |
| 100 | 877K | 575K | 606K | 308K |
| 90 | 141K | 157K | 174K | 152K |
| 85. | 99K | 126K | 139K | 148K |

In other words, in all cases WebP appears to be useless compared even to JPEG, and at a high quality level, AVIF is also not helping. Also, resizing from JPEG to a smaller JPEG at 100% doesn’t reduce the size at all.

So the heuristic to follow might be to completely forget about WebP, use AVIF when available only if the quality is 95 or lower, and when using JPEG at a high quality, consider just using the original JPEG instead.

This doesn’t sound right… Anything I’m missing here?

Hi, it really depends on the datasets and users you are targeting AVIF image format | Can I use... Support tables for HTML5, CSS3, etc.

I won’t explain better than this article Using Modern Image Formats: AVIF And WebP — Smashing Magazine. Look at the comparison examples.

As for Cloudflare, we try to apply higher compression on heavy codes like AVIF whenever we can on a best-effort basis, but can fallback to lower compression levels in order to satisfy all customers.

This information should be useful to know Supported formats and limitations · Cloudflare Image Optimization docs

This topic was automatically closed after 15 days. New replies are no longer allowed.