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.exists()){
System.out.println("Image file exists.");
BufferedImage originalImage = ImageIO.read(file);
}
So image exists but ImageIO.read(file) returns NULL. No thrown errors nothing!!! Whats going on?
This is what I have tried so far:
Can someone help with this? I'm new to this, not sure how to fix this.
Ok I just figured out that ImageIO.getImageReaders(stream) returns an empty Iterator. This means that it couldn't find a suitable reader? How am I supposed to read this image?
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.