Hi

At the moment Imaging does not support saving to JPEG, and can only
write TIFF in black and white, and RGB (see photometricInterpretation
in the writeImage() method in
org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java).

I don't think a patch for CMYK would be hard to write though.

Regards
Damjan

On Wed, Sep 11, 2013 at 12:18 PM, samhe <u...@163.com> wrote:
> 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, params);
>
> 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!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to