E
Enric Tordera
I'm trying to write some code to read the embedded thumbnails present in
JPEG images from digital cameras. I am using the ImageIO library
This is the code:
---------------------------------------------------
ImageInputStream iis = ImageIO.createImageInputStream(new
FileInputStream(filename));
Iterator readers = ImageIO.getImageReadersByFormatName("jpg");
ImageReader reader = null;
while (readers.hasNext()) {
reader = (ImageReader)readers.next();
if (reader.readerSupportsThumbnails()) {
reader.setInput(iis, true);
System.out.println("NumThumbnails:" + reader.getNumThumbnails(0));
}
}
----------------------------------------------
It always prints "0", so it seems the library can't find any Thumbnail
in the JPEG file, although I'm sure it is there.
Here are the questions:
* May be the embedded thumbnail is in the EXIF information, so ImageIO
does not support it?
* Is there another ImageReader available that fully supports reading
thumbnails?
* Any hint on how to do this?
Thanks in advance for your help.
- Enric
JPEG images from digital cameras. I am using the ImageIO library
This is the code:
---------------------------------------------------
ImageInputStream iis = ImageIO.createImageInputStream(new
FileInputStream(filename));
Iterator readers = ImageIO.getImageReadersByFormatName("jpg");
ImageReader reader = null;
while (readers.hasNext()) {
reader = (ImageReader)readers.next();
if (reader.readerSupportsThumbnails()) {
reader.setInput(iis, true);
System.out.println("NumThumbnails:" + reader.getNumThumbnails(0));
}
}
----------------------------------------------
It always prints "0", so it seems the library can't find any Thumbnail
in the JPEG file, although I'm sure it is there.
Here are the questions:
* May be the embedded thumbnail is in the EXIF information, so ImageIO
does not support it?
* Is there another ImageReader available that fully supports reading
thumbnails?
* Any hint on how to do this?
Thanks in advance for your help.
- Enric