I'm having a bit of trouble opening a cmyk image and saving it again as
cmyk, it actually does save as cmyk but the colors are totally off

below is the code im using, I basically just want to open a cmyk image,
write some text and shapes onto the image (using Graphics2D), then save it,
but I removed the part of the code where it writes on the image for
simplification of the code listing here



public static void main(String args[]) throws Exception {
       String inputImageFileName = "front_cmyk.jpg";
       String outputImageFileName = "front_" +
System.currentTimeMillis() + ".jpg";
       OutputStream out = new FileOutputStream(outputImageFileName);

       JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(new
FileInputStream(inputImageFileName));
       BufferedImage image = decoder.decodeAsBufferedImage();

       JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
       JPEGEncodeParam param =
encoder.getDefaultJPEGEncodeParam(image.getRaster(),
JPEGDecodeParam.COLOR_ID_CMYK);
       //JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(image);
       param.setQuality(1, false);

       encoder.encode(image.getRaster(), param);
       //encoder.encode(image, param);


out.close(); System.out.println("output file name: " + outputImageFileName); }

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to