Open thekalinga opened 9 years ago
Hi Ashok,
There seems to be two different issues here:
1: The image you are mentioning is a PNG file. It reads fine, using the standard JRE PNGImageReader
.
If you try to force reading it using the JPEGImageReader
, you should get an error saying "Not a JPEG stream (starts with: 0x8950, expected SOI: 0xffd8)".
2: The stack trace you have posted is from the JPEGImageReader
. So most likely, it is from a different file.
Anyway, the JPEG standard specifies a lot (16, in fact) different algorithms (or "processes") for compressing image data. Most JPEGs uses only baseline or progressive options, with standard Huffman coding, so most decoders will not implement all of these options. Ours don't. The error message "Unsupported JPEG process: SOF type 0xce" is just a technical way of saying, "Sorry, we can't decode this JPEG because it is using progressive DCT process, with differential arithmetic coding, and we* haven't implemented that".
*) We, in this case, is the Independent JPEG Group (IJG). The TwelveMonkeys JPEG plugin delegates all encoding/decoding to the native code provided by the JRE, which for all Oracle derived and standard OpenJDK JREs will be the IJG's LibJPEG.
Best regards,
Harald K
Hi,
The failure is due to test-image-differential-progressive-arithmetic.jpg
, which you rightly said. Is it because this image contains a "process" that is not currently part of twelve monkeys?
I'm sorry. I din't pay enough attention to that error and made a wrong assumption.
Also, I tried transforming test-image-48-bit-reduced-to-24-bit.png
-> JPG and it generated 0 bytes JPG, without throwing any exception.
Any idea what could be causing this issue (As you might have noticed, I'm quite novice in image processing basics).
Here is the snippet I borrowed for this transformation
ImageInputStream imageInputStream = ImageIO.createImageInputStream(rawImageStream);
Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(imageInputStream);
ImageReader imageReader = imageReaders.next();
imageReader.setInput(imageInputStream);
BufferedImage bufferedImage = imageReader.read(0, reader.getDefaultReadParam());
boolean hasAlpha = bufferedImage.getColorModel().hasAlpha()
|| bufferedImage.getType() == BufferedImage.TYPE_4BYTE_ABGR
|| bufferedImage.getType() == BufferedImage.TYPE_BYTE_INDEXED;
if (hasAlpha) {
BufferedImage rgbBufferedImage =
new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(),
BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = rgbBufferedImage.createGraphics();
graphics.drawImage(bufferedImage, 0, 0, null);
graphics.dispose();
bufferedImage = rgbBufferedImage;
}
Thanks again
Edit: Corrected the description to be more accurate
Hi,
Since you mentioned in one of your presentation that the library is tested with all the images in the same project, I'm opening this ticket.
When I tried processing test-image-48-bit-reduced-to-24-bit.png with twelve monkey's library, I get the following error
Can you please let me know what the issue is?