mozilla / mozjpeg

Improved JPEG encoder.
Other
5.43k stars 417 forks source link

Wrong colorspace error #267

Open Ser-Gen opened 6 years ago

Ser-Gen commented 6 years ago

I have problem with compressing an image.

broken

With settings -quality 92 I got this file.

cjpeg_broken

In iOS Safari, Photoshop and in some other tools this image looks a bit more glamourous

image

Most likely it happens because Adobe Tag of original image APP14 have a ColorTransform somehow set to 0 [Unknown (RGB or CMYK)].

Maybe show an error about wrong colorspace?

FYI Guetzli throw error before proceed image https://github.com/google/guetzli/blob/cb5e4a86f69628f685f2b78d7429e248ab83d8d7/guetzli/processor.cc#L905

Seems like they check it here https://github.com/google/guetzli/blob/0e4900983924d1936f3a0ddf9b37164543e8fb5b/guetzli/jpeg_data_decoder.cc#L25

> cjpeg -version
mozjpeg version 3.2 (build 20170918)
kornelski commented 6 years ago

Yes, indeed. This is probably a CMYK JPEG which isn't supported. If you can use PNG input for mozjpeg.