Ok I have an Image that I\'m trying to read. Problem is that the Image.read(file) returns NULL.
File file = new File(\"C:\\\\images\\\\image1.jpg\");
if(file.exi
Awesome, I had the same problem, wherein it was supporting 24 image formats in eclipse but was supporting only 12 image formats in command prompt with maven. Once I placed jai_imageio.jar in maven's test path, maven has begun to support 24 image formats as well.
Ok since I switched laptops, I looked at my old laptop and found this JAR jai-imageio.jar in the jre/ext/lib (I know bad idea). I moved it to my project/lib and it worked! I guess this jai-imageio.jar contains additional image readers.
From the Javadocs for ImageIO.read()
Returns a
BufferedImage
as the result of decoding a supplied File with anImageReader
chosen automatically from among those currently registered. TheFile
is wrapped in anImageInputStream
. If no registeredImageReader
claims to be able to read the resulting stream,null
is returned.
Try creating an ImageInputStream
, then pass that onto the ImageIO.read() method, instead of sending the file itself.