3

I have a problem to read a specific jpeg image (CMYK color space) which have been created with ImageMagick :

inputStream = new ByteArrayInputStream(bytesImage);
bufferedImage = ImageIO.read(inputStream); 
//IIOException : unsupported image type

I tried to use JAI instead of ImageIO but it still doesn't work :

seekableStream = new ByteArraySeekableStream(bytesImage);
bufferedImage = JAI.create("Stream", seekableStream).getAsBufferedImage();
//Unable to render RenderedOp for this operation

Any idea to solve my problem?

FranckJS
  • 53
  • 1
  • 2
  • 6

2 Answers2

3

Reading JPEG images with CMYK colors is rather tricky in Java. But I've posted a complete solution here. It solves the problem of dark colors becoming white as well.

Community
  • 1
  • 1
Codo
  • 75,595
  • 17
  • 168
  • 206
2

Since I have found my image has a CMYK color space, I have found a solution on stackoverflow : Problem reading jpeg image using imageio

Now, the problem is the quality of my resulting image... dark colors became white...

Community
  • 1
  • 1
FranckJS
  • 53
  • 1
  • 2
  • 6