How can I load a CMYK jpeg image (originally saved from Photoshop) and then
turn it into an rgb BufferedImage, in order to display it on screen in an
applet?
I first tried ImageIO.read(), but that does not work for cmyk jpegs. I then
looked into the com.sun.image.codec.jpeg package, and tried methods like
decodeAsBufferedImage() and decodeAsRaster().
The first one (decodeAsBufferedImage) returned an image, but it seems that
it was interpreted as an ARGB, and the colors were incorrect.
I then read the documentation which (amongst many other things) stated that
"If the user needs better control over conversion, the user must request the
data as a Raster and handle the conversion of the image data themselves."
This made sense, so I took to decodeAsRaster(), only to find that I could
not figure out how to carry out the desired conversion.
Of course, I have looked into the documentation for BufferedImage, Raster,
ColorModel, ColorSpace etc, but after a while I was lost. (Before I got lost
I read that you can convert images with the help of methods like toRGB,
toCIEXYZ.)
I have a feeling that this is probably pretty simple if you just know how to
do it, but I sure would need some directions here.
Any help would be appreciated. Thanks.
Mats Olsson