Encode JPEG as CMKY instead of RGB using JPEGEncodeParam?
posted 12 years ago
Hi, I have a program that opens a jpeg, writes text on the image, and saves it as a jpeg. Only problem is that I need it as a CMYK jpeg instead of RGB. Any way to do this? I tried opening a CMYK file but java wont seem to do it. It seems to be fine with RGB and grayscale. I've seen mention of something referred to as COLOR_ID_CMYK. Is that what I need? How would I use it? Here is a snippet from my code that writes the jpeg now.. only as RGB jpeg: -------------------------- JPEGEncodeParam param = JPEGCodec.getDefaultJPEGEncodeParam(image); param.setQuality(1.0f,false); //set quality to 100% //set dpi using density param.setDensityUnit(JPEGEncodeParam.DENSITY_UNIT_DOTS_INCH); param.setXDensity(300); param.setYDensity(300); JPEGImageEncoder enc = JPEGCodec.createJPEGEncoder(fos, param);