ImageIO.read returns NULL, with no errors

ImageIO.read(*...) will only load these image types GIF, PNG, JPEG, BMP, and WBMP.

Any other image type will return null without error.

reference: http://docs.oracle.com/javase/tutorial/2d/images/loadimage.html

I do realize this is not a solution to the specific original problem but it is a solution to the question asked.


ImageIO.read(file); will return null if no registered ImageReader is found. Please check whether you have registered any ImageReader.

I think this code snippet could help you

File file = new File("bear.jpg"); // I have bear.jpg in my working directory  
    FileInputStream fis = new FileInputStream(file);  
    BufferedImage image = ImageIO.read(fis); //reading the image file  

You just need to wrap the file into an FileInputStream and then pass it to read()