commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samhe <>
Subject [imaging] save a image in cmyk
Date Wed, 11 Sep 2013 10:18:47 GMT
Hello , i have some problem in using Apache Common Imaging , please do me a favor.
I want to write some text in a cmyk image  in JPEG or TIFF. First , i got BufferedImage from
the source cmyk image in JPEG, and i found it is in RGB color space , so I use ColorTools
to convert it to cmyk color space, and save it in JPEG and TIFF, but when i open the image
file with photoshop , it's  also in RGB. The code does not work, or something i did wrong?
My code like this:
ICC_Profile rgbProfile = ICC_Profile.getInstance("D:\\test\\AdobeRGB1998.icc");
ColorSpace rgbColorSpace = new ICC_ColorSpace(rgbProfile);
ICC_Profile cmykProfile = ICC_Profile.getInstance("D:\\test\\JapanColor2001Coated.icc");
ColorSpace cmykColorSpace = new ICC_ColorSpace(cmykProfile);
ColorTools colorTools = new ColorTools();
//BufferedImage cmykImage = colorTools.convertBetweenColorSpaces(image, rgbColorSpace, cmykColorSpace);
BufferedImage cmykImage = colorTools.convertToColorSpace(image, cmykColorSpace);
ImageFormat format = ImageFormat.IMAGE_FORMAT_TIFF;
Map<String,Object> params = new HashMap<String,Object>();
params.put(ImagingConstants.PARAM_KEY_FORMAT, ImageFormat.IMAGE_FORMAT_TIFF);
Imaging.writeImage(cmykImage, new File("d:/test/yyyyyyyyy.tif"), ImageFormat.IMAGE_FORMAT_TIFF,

I find some classes  about cmyk in api doc , but  i do not know how to use them. And  cannot
found more information or document about it in internet.
so ... please give me some demo or point out my code error . Thank you!

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message