Filosssof
Filosssof

Reputation: 1358

Java: How to work with CMYK image?

I know that RGB is for monitors and CMYK is for printing, but I want to work with CMYK without any conversions. I want to upload a CMYK image (jpeg) and print it. But when I used com.sun.image.codec.jpeg.JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(is); return decoder.decodeAsBufferedImage(); I got an inversed colors image. How can I get the same image in CMYK?

Upvotes: 0

Views: 2933

Answers (1)

Codo
Codo

Reputation: 78835

There reason your colors are inverted is that you have a special variant of a CMYK JPEG image, namely Adobe CYYK. The strange colors are due to an old Photoshop bug (CMYK values are inverted) that has now become a de-facto standard that's handled by most JPEG software (except Java).

A proper CMYK conversion (handling different variants, using proper color profile etc.) can be found in: https://stackoverflow.com/a/12132630/413337.

Upvotes: 2

Related Questions