ripe-tech / ripe-sdk

The public Javascript SDK for RIPE Core
https://www.platforme.com
Apache License 2.0
8 stars 4 forks source link

"lossless" image format is not lossless #311

Closed gcandal closed 3 years ago

gcandal commented 3 years ago

Description

When using lossless as an image format, it's expected to be served images which are lossless, but that's not the case for webp with the default options.

Example:

ripe-tobias-bot[bot] commented 3 years ago

Woof, Woof!

Thank you for submitting the ""lossless" image format is not lossless" issue 😎.

Please do not forget to review our internal guidelines:

Engaging in the development process in the best possible way helps it being efficient and fast.

Your friend, Tobias (Platforme's mascot)

Tobias Bot
joamag commented 3 years ago

Let's not be strict here "Lossless == Almost lossless" 😆 Now seriously nice catch

joamag commented 3 years ago

Let's make default webp options lossless and measure the impact in image size, then discuss on this one

3rdvision commented 3 years ago

After a deeper investigation I've come to realize that this could not be fixed by increasing the quality = 100 (currently at 95) implemented here - the quality degradation from changing 95 -> 100 looked visually imperceptible to my eyes.

The buggy "blur" effect, mostly evident on the initials "MARTA" is being caused by the python imaging library most specifically the PIL.WebPImagePlugin which we use when saving the image composition at image.save for webp format. This WebPImagePlugin has lossless at false by default and that was the cause of this blur effect.

Below are the image compositions

- -
current webp at 90% quality = 247.27 kb
lossless webp at 95% quality = 913.13 kb imagem
lossless webp at 100% quality = 913.6 kb imagem
png = 1.27 MB imagem

I'm creating a PR for the 2nd option lossless webp at 95% quality = 913.13 kb

gcandal commented 3 years ago

https://github.com/ripe-tech/ripe-compose/pull/133#issuecomment-925997082