yan74 / afplib

JAVA Library for reading & writing AFP (Advanced Function Presentation) Files.
Apache License 2.0
37 stars 22 forks source link

How to convert PNG/JPG image to CMYK and separated the color planes and stored the data uncompressed in .dat files? #38

Closed gurunathrokkam closed 5 years ago

gurunathrokkam commented 5 years ago

Hi @yan74,

Can you help on "convert the image to CMYK and separated the color planes and stored the data uncompressed in .dat files"?
I tried using ImageMagick, but couldn't.

Is it possible in Java by chance?

Thank you in advance.

Originally posted by @gurunathrokkam in https://github.com/yan74/afplib/issues/20#issuecomment-434578260

yan74 commented 5 years ago

Hi @gurunathrokkam,

to separate the CMYK with image magick this should do the trick: convert <input> -colorspace CMYK -channel K -separate channel_black.dat (found here: http://www.imagemagick.org/Usage/color_basics/#separate)

Doing this in Java is painful as I wrote earlier :) - I once did the opposite (merging CMYK bands into a single RenderedImage) using the BandMerge JAI Operation. You may be able to achieve separation by using the BandSelect (https://docs.oracle.com/cd/E17802_01/products/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/BandSelectDescriptor.html) however I have not tried this.

gurunathrokkam commented 5 years ago

Thanks @yan74