XF 2.3 webp image optimization very low

ekool

Well-known member
Licensed customer
I've done lots of 2.3 upgrades and enabled image optimization for webp. I usually leave the default src/config.php value which I believe is 85%. After optimizing all images I usually see a reduction in the attachment usage in the 50% range.

I ran it on one of our sites and the attachment folder went down from 58.2 GB to 53.8GB.

On another site I did the same optimization with the same settings and it reduced it from 40.1GB to 27.3GB. That's more inline with what I've seen previously.

I downloaded one of the images to my machine and ran cwebp on it with the default settings and it reduced the (already supposedly reduced) image substantially. What's going on here?

Code:
❯ ls -lh
total 1152
-rw-r--r--@ 1 ekool  staff   576K May 12 09:32 IMG_1014.webp
❯ cwebp IMG_1014.webp -o after.webp
Saving file 'after.webp'
File:      IMG_1014.webp
Dimension: 2990 x 2853
Output:    362296 bytes Y-U-V-All-PSNR 41.95 51.03 51.68   43.47 dB
           (0.34 bpp)
block count:  intra4:      22459  (67.10%)
              intra16:     11014  (32.90%)
              skipped:      1226  (3.66%)
bytes used:  header:            278  (0.1%)
             mode-partition: 103470  (28.6%)
 Residuals bytes  |segment 1|segment 2|segment 3|segment 4|  total
    macroblocks:  |       4%|      26%|      17%|      53%|   33473
      quantizer:  |      36 |      35 |      27 |      19 |
   filter level:  |      11 |      37 |      48 |      26 |
❯ ls -lh
total 1864
-rw-r--r--@ 1 ekool  staff   354K May 12 09:52 after.webp
-rw-r--r--@ 1 ekool  staff   576K May 12 09:32 IMG_1014.webp

I modified the src/config.php and set the optimization level to 70% and re-ran the image optimization job via cmd.php but it won't re-optimize the images since it thinks they are already optimized. I guess there is no way to force it to redo it at 70%.

I just find it strange that on this one system the optimization worked so poorly and clearly there is a lot of optimization that can be done. After I optimized the above image I viewed both and could not see any difference in image quality.

Anyone know what could be going on?
 
any gd vs imagik differences?

All sites are configured for imagick. The setup is the same across all sites really. And all optimizations are done using cmd.php. I can't think of any difference on this site vs. any other sites which is what makes it so strange.

Is there any way to force it to re-optimize with the new lowered quality value? I wonder where the actual "code" is to optimize the images, perhaps I can get AI to write a version that actually runs cwebp on the images. I know that might be an issue because you can't just run it directly on the files and have the attachments work, too much other info is stored in the database :(
 
The reduction is very dependent on how much compression is applied to the image before changing to webp. The greater the original image is compressed = less webp compression.
 
The reduction is very dependent on how much compression is applied to the image before changing to webp. The greater the original image is compressed = less webp compression.

I understand that but our compression ratio before on this site was the same as the others. In addition, I wouldn't expect me to be able to download a .webp image after it's been optimized by Xenforo and then optimize it even more with cwebp's default settings.

My test image went from a 576k .webp image to a 354k .webp image... so there's still a lot of optimization left on the table. I just checked and the default cwebp compression is 75%.
 
Back
Top Bottom