Skip to main content

JPEG 32-bit CMYK supported?

3 replies [Last post]
koldyr
Offline
Joined: 2006-09-08

Sorry, searched but didn't found explicitly mentioned is JPEG 32-bit CMYK supported? if yes could you provide some sample to read it to BufferedImage?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
koldyr
Offline
Joined: 2006-09-08

after some investigation found following way

private static BufferedImage loadByJAI(byte[] imageData) throws IOException {
BufferedImage src = null;
final SeekableStream stream = new ByteArraySeekableStream(imageData);
try {
final String[] codecs = ImageCodec.getDecoderNames(stream);
if (codecs.length > 0) {
final ParameterBlock params = new ParameterBlock();
params.add(stream);
final PlanarImage planarImage = (PlanarImage) CodecRIFUtil.create(codecs[0], params, null);
src = planarImage.getAsBufferedImage();
}
} finally {
stream.close();
}
return src;
}

but resulting BufferedImage is negative.
following code has the same effect:
BufferedImage image = JAI.create(ReadImageTask.OPERATION_FILELOAD, path.getAbsolutePath()).getAsBufferedImage();

seems something wrong with color model

Message was edited by: koldyr

robert engels

type

imageio jpeg cmyk

into google, you'll find lots of information

On Mar 14, 2009, at 6:34 AM, jai-imageio@javadesktop.org wrote:

> after so investigation found following way
>
> private static BufferedImage loadByJAI(byte[] imageData) throws
> IOException {
> BufferedImage src = null;
> final SeekableStream stream = new ByteArraySeekableStream
> (imageData);
> try {
> final String[] codecs = ImageCodec.getDecoderNames
> (stream);
> if (codecs.length > 0) {
> final ParameterBlock params = new ParameterBlock();
> params.add(stream);
> final PlanarImage planarImage = (PlanarImage)
> CodecRIFUtil.create(codecs[0], params, null);
> src = planarImage.getAsBufferedImage();
> }
> } finally {
> stream.close();
> }
> return src;
> }
>
> but resulting BufferedImage is negative. seems something wrong with
> color model
> [Message sent by forum member 'koldyr' (koldyr)]
>
> http://forums.java.net/jive/thread.jspa?messageID=336986
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

koldyr
Offline
Joined: 2006-09-08

> type
>
> imageio jpeg cmyk
>
> into google, you'll find lots of information
>
well, it wasn't quite direct answer but i found it wonderfully helpfull