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 https://developers.cloudflare.com/images/image-resizing/resize-with-workers/.

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:
https://az712897.vo.msecnd.net/images/full/E89A28C3-EA32-4174-BE5B-99776043D89A.jpeg
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?