Hey all,
Whenever I try to get an ImageInputStream
object using ImageIO.createImageInputStream
it simply returns null
with no exceptio
Why are you doing all that?? you can simply do this:
image = ImageIO.read(source);
No Iterators
, ImageInputStreams
... no nothing !
EDIT: Since you insist, your code is not working because you're sending a File
to ImageIO.getImageReaders()
instead of a ImageInputStream
. SO your code should look something like that:
ImageInputStream iis = ImageIO.createImageInputStream(source);
Iterator readers = ImageIO.getImageReaders(iis);
ImageReader reader = (ImageReader) readers.next();
reader.setInput(iis, false);
image = reader.read(imageIndex);