ImageIO Progress Tracking

Does anyone know how to track the progress of ImageIO loading images? I’d like to have a progress displayed as I load some fairly big images, however, I only seem to be able to get down to the granularity of images loaded/not loaded.

Any help appreciated,

Kev

Never done anything like that… but this should be the right direction:

http://java.sun.com/j2se/1.4.2/docs/api/javax/imageio/event/IIOReadProgressListener.html

You could create a ByteCounterInputStream that counts how many bytes that have been read. It would give you a better granularity as long as ImageIO don’t buffer up the whole file.

Yes, this can be easily done using the abovementioned IIOProgressListener.

Check out the IIO guide:
http://java.sun.com/j2se/1.4.2/docs/guide/imageio/spec/apps.fm7.html#997167

Thanks,
Dmitri
Java2D Team

Super, never actually used the readers directly before, I’ve always just used ImageIO.read() which doesn’t allow a progress listener… would be nice if it did :slight_smile:

Kev