weserv / images

Source code of wsrv.nl (formerly images.weserv.nl), to be used on your own server(s).
https://wsrv.nl/
BSD 3-Clause "New" or "Revised" License
2.05k stars 200 forks source link

Gray scale JPEG image is turned into a PNG with inverted colors after caching #370

Closed sasensi closed 1 year ago

sasensi commented 1 year ago

First, thanks a lot for this service which I'm a huge fan of an which I use regularly.

This is the third time that I notice a weird behavior with some kinds of images so I decided to report it in case there is something to fix about it. The first two times, I didn't gather the input image so I'm only able to provide one now but I know that it happened other times in the past with other images.

So here are:

I don't know much about image format and neither about the processing that you apply on them by default. But I had a quick look at two input files (one which is working and this one) with exiftool. And I noticed that, among other differences, this image was referenced as a gray scale one so I wonder if this could be a clue ?

In the past, in order to workaround this, I opened and resaved the file in a software like Photoshop. I guess that this changed the meta data and somehow fix the issue.

Hoping that you can help me with this. Thanks in advance.

andrieslouw commented 1 year ago

@kleisauke: Care to investigate? Maybe a funky color-profile? Not sure if it's libvips or some third-party lib.

andrieslouw commented 1 year ago

I've been informed that it indeed is libvips, and that a fix is being worked on since your report. We'll update if there's more info.

andrieslouw commented 1 year ago

In the meantime, &output=jpg will mitigate the issue: https://images.weserv.nl/?url=https://cipmarseille.fr/images/auteurs/2043_auteur_20120511174919.jpg&output=jpg

sasensi commented 1 year ago

@andrieslouw, awesome, thank you for your updates and advices.

kleisauke commented 1 year ago

This has been fixed with libvips 8.14.2 (see https://github.com/libvips/libvips/discussions/3361 for details), which has just been rolled out to production. Thanks for reporting this!

sasensi commented 1 year ago

Thank you very much for the fix.