Lymphatus / caesium-clt

Caesium Command Line Tools - Lossy/lossless image compression tool
http://saerasoft.com/caesium
Other
357 stars 34 forks source link

CMYK images combined with -q option cause corrupted output #21

Closed bardiir closed 6 years ago

bardiir commented 6 years ago

When using -q 80 for example with a cmyk image it causes the result to be an empty black image.

/caesium # caesiumclt -q80 -o out cmyk.jpg 
(1/1) cmyk.jpg -> out/cmyk.jpg
1.17 MB -> 2.70 KB [-99.77%]
-------------------------------
Compression completed in 0m0s170ms
1.17 MB -> 2.70 KB [-99.77% | -1.17 MB]

Original: cmyk

Optimized: cmyk

Lymphatus commented 6 years ago

The libcaesium, which powers caesium-clt, can't fully handle CMYK images, as they are made for printing and not for display. Fully managing all color profiles is a bit off the scope of the library, so I decided to make a tradeoff: if the image is has CMYK color profile, the library won't attempt to lossy compress it - like you did, by passing the -q80 argument - but will print a warning and losslessly compress it as if you would pass the -q0 argument, regardless of the quality value.

Full CMYK support won't probably ever come.

bardiir commented 6 years ago

Thats perfectly fine too. I agree that a web focused optimization library doesn't really need to handle color profile conversions, although it might make sense in the long run to convert everything to sRGB and drop all attached color profiles too. That would save some space while maintining relatively good compatibility with almost everything.