-1

I got this exception when my app is trying to read a JPG image using ImageIO.read( ) method. This exception is not thrown for all jpg file.

I found this answer useful Intersection of bands in R raster package, but still it converts my colored image to a black n white one. I guess that question has focused on the right issue, but I want it to keep my image colored(not black and white).

Download image: https://skydrive.live.com/?cid=19547371C4F3B839&id=19547371C4F3B839%21105

Simply if someone can obtain a BufferdImage from the image given that's enough (should not convert the image to gray scale one).

You are a genius if you can answer this :D. Plz help.

Community
  • 1
  • 1
Shanaka Kuruwita
  • 689
  • 2
  • 6
  • 19

1 Answers1

0

That is typically the exception you get when Java cannot read the JPEG file. While they are standard compliant JPEGs Java has not implemented the full standard. I recommend converting the JPEG file with ImageMagick, Irfanview, or something like this before actually trying to open it in Java.

You may use ImageJ, which can deal with most JPEGs.

Mathias
  • 324
  • 1
  • 5
  • Thanks Mathias for the reply. I tried this but I couldn't get a BufferedImage Object form this. It gives only ToolkitImage. And it's not possible to convert that ToolkitImage to BufferedImage as well. So it would be great if you could suggestion a way to convert my image to a BufferdImage object. Thanks alot again. – Shanaka Kuruwita Aug 21 '13 at 07:32