wp-media / imagify-plugin

Speed up your website with lighter images without losing quality.
https://imagify.io
69 stars 24 forks source link

Webp versions of images do not respect compression quality #689

Closed PaulSchiretz closed 1 year ago

PaulSchiretz commented 1 year ago

Describe the bug The webp version of the image doesn't reflect the used compression level. It always looks compressed no matter if lossless or smart compression is selected.

To Reproduce Steps to reproduce the behavior:

  1. Compress an image
  2. Make sure generate webp is checked, save the webp image
  3. Recompress with lossless compression
  4. Compare the 2 webp images

Expected behavior I would expect that the webp images to be less compressed when i use lossless compression than when i use smart compression. I expect the api to be able to handle different compression levels for webp also. something like 80% 90% 95% compression ratio.

As mentioned in the support thread:

It looks more like the compression quality of the webp images is around 80% even if i choose lossless compression from the plugin settings. Sample images can be found in the support thread https://github.com/wp-media/imagify-plugin/pull/687

Additional context The issue was mentioned by @GeekPress here: https://github.com/wp-media/imagify-plugin/pull/687 you are aware of this bug:

https://github.com/wp-media/imagify-plugin/pull/687#issuecomment-1261874193

By some users this was mentioned here: https://wordpress.org/support/topic/webp-compression-3/

jbma commented 1 year ago

@PaulSchiretz It was an issue on the api side. We've released an update which solved that issue. I'm closing the issue, let us know if you still have the issue

PaulSchiretz commented 1 year ago

@jbma thanks for the fast response, is the api update already available for users of imagify 2.0? If so i can tell it's not resolved the webp is still overcompressed. Or do i have to wait for 2.1?

jbma commented 1 year ago

Hi, yes this was pushed in the API directly so it's available for everyone. When you choose two level of compression you have the same results for Webp?

PaulSchiretz commented 1 year ago

Hi, yes there is no difference if i compress an image with losless compression and generate a webp or if i choose smart compression and generate webp. The webp image always has some compression artefacts... my source images are png and i guess you are using some default compression ratio for generting webp, from my tests around 80% but if i choose losless compression i think also the webp should be approximatly lossless. But as it is now the webp is always exactly the same quality smart/lossless has no effect.

Here are some test images, the png images are always the uncompressed originals:

https://drive.google.com/drive/folders/1JTN-YImgUm2KKUbIU2o_aSp7BqYKIRgX

Specially interessting are the images with Q80 and so on in the name i would expect a webp with near lossless compression to look like Q90 file generated by imagik quality 90 and still a nice filesize reduction but the imagify result, the one with .png.webp extension looks more like Q80 if you look at the middle if the flower you can clearly see the compression... i guess your setting for webp works well with jpg but for png sources the compression of the webp image is just way to high... so they are always compressed with artefacts no matter what setting. thanks for looking into this again!

jbma commented 1 year ago

Hi Paul, the upcoming version of the plugin should fix that issue. In the mean time we are pushing this afternoon an fix to our API, which will handle the Webp compression for PNG in a better way (on the smart mode). Once deployed you should restore and re-optimize the image

PaulSchiretz commented 1 year ago

:-D i was just about to jump the ship, you literally catched me last minute. Please let me know once it's deployed so i can see if it's better now...

xakiv commented 1 year ago

Hi @jbma @PaulSchiretz, The WebP compression update has been deployed.

PaulSchiretz commented 1 year ago

Thank you @jbma and @xakiv, the images are way better now and still reasonable small! Great work, you just kept your self a customer!

jbma commented 1 year ago

Thank's @PaulSchiretz for your feedback :)