discord / lilliput

Resize images and animated GIFs in Go
https://discord.com/blog/how-discord-resizes-150-million-images-every-day-with-go-and-c
Other
1.95k stars 122 forks source link

PNG compression algorithm causing desaturation #80

Open 2chen opened 3 years ago

2chen commented 3 years ago

It seems lilliput's algorithm for compressing PNGs is causing them to become noticeably desaturated compared to the original image. I also tested Google's Hangout's compression algorithm which didn't result in desaturation (incidentally lilliput's file size is also ~25% larger than Google's)

Examples

Original image (105 kb):

original-wintermelon

lilliput compression (via Discord) (95 kb) (notice how the red and green are desaturated vs the original): discord-wintermelon

Google compression (via Google Hangouts) (76 kb): gchat-wintermelon

skidder commented 1 month ago

@2chen I understand this issue was filed a long time ago, sorry for the (very) late reply. Lilliput did not preserve ICC color profile data at the time you reported this issue. It's possible that the behavior you saw was due to the resulting image lacking color profile info. We have since fixed that issue with PR #156 , and will propagate ICC color profile data when possible.