GoogleChromeLabs / squoosh

Make images smaller using best-in-class codecs, right in the browser.
https://squoosh.app
Apache License 2.0
21.71k stars 1.52k forks source link

Support better color management (RGB profile etc) #348

Open kosamari opened 5 years ago

kosamari commented 5 years ago

Splitting from issue #270


[may belong to codecs’s repos, but Sqoosh could surface some control] Colour management behaviour is inconsistent. At times broken/dangerous. For PNGs, all input is converted to sRGB , but the sRGB chunk is not set (questionable, although browsers got better at assuming sRGB). For JPGs, RGB profiles are converted, while CMYK ones are a problem, again output is, at times, in sRGB, but there is not profile embedded.

HugoGresse commented 2 years ago

A temporary solution for anyone having this issue is to use Sharp with:

const correctColorSpaceBuffer = await sharp(arraybuffer).toColorspace("srgb").toBuffer()