Question

I'm trying to convert an RGB image to a CMYK image using Java. I've looked at this code:

BufferedImage rgbImage = ImageIO.read(new File("d:\\Temp\\IMG_1748x2480.jpg"));
BufferedImage cmykImage = null;
ColorSpace cpace = new ICC_ColorSpace(ICC_Profile.getInstance(
                   TestConvertRGBToCMYK.class.getClassLoader().getResourceAsStream(
                   "CMYK_Profiles/USWebCoatedSWOP.icc")));
ColorConvertOp op = new ColorConvertOp(rgbImage.getColorModel().getColorSpace(), cpace, null);
cmykImage = op.filter(rgbImage, null);    
ImageIO.write(cmykImage, "JPEG", new File("d:\\Temp\\CMYK_Sample_RGB_OUTPUT2.jpg"));

But the problem is that the result image appears black. After reading the Google point of view (posts) I've read that this is normal, because the views aren't compatible with the CMYK images, but PDF views are. But the problem is if I put the image in the PDF, the image continues to appear black.

Does any one have any idea for what is going one? Or have any other converter that does a better conversion?

Was it helpful?

Solution

Just an update of my problem.

Use ImageMagick software and i get all my problems resolved.

Cheers,

Bigster

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top