To convert RGB image to CMYK image by Java, one of the easiest way is to use JAI (Java Advanced Image).
Download JAI: http://download.java.net/media/jai/builds/release/1_1_3/
DownLoad JAI ImageIO: http://download.java.net/media/jai-imageio/builds/release/1.1/
Here is the code:
public static void rgbToCmyk() throws IOException{
BufferedImage rgbImage = ImageIO.read(new File("C://Users//Public//Pictures//Sample Pictures//RGB_IMAGE.jpg"));
BufferedImage cmykImage = null;
ColorSpace cpace = new ICC_ColorSpace(ICC_Profile.getInstance(RbgToCmyk.class.getClassLoader().getResourceAsStream("ISOcoated.icc")));
ColorConvertOp op = new ColorConvertOp(rgbImage.getColorModel().getColorSpace(), cpace, null);
cmykImage = op.filter(rgbImage, null);
JAI.create("filestore", cmykImage, "c:/tmp/CMYK_IMAGE.TIF", "TIFF");
}
NOTE: "ISOcoated.icc" is my ICC profile. You can get it from your printer or somewhere else.