TIFF - get metadata

Could you please gimme an example on how can i retrieve a TIFF's comment?
[81 byte] By [derbeerka] at [2007-11-26 21:10:17]
# 1

This is an example how to read the image width tag.

ImageIO does not support tiffs by default.

You need to download jai_imageio.jar and put it in your build path.

You can find it here:

https://jai-imageio.dev.java.net/binary-builds.html

ImageInputStream is = ImageIO.createImageInputStream(new File("d:/tiffs/test/test.tif"));

ImageReader reader = (ImageReader) ImageIO.getImageReaders(is).next();

reader.setInput(is, true);

TIFFImageMetadata metadata = (TIFFImageMetadata) reader.getImageMetadata(0);

TIFFField field = metadata.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_WIDTH);

int imageWidth = field.getAsInt(0);

Rodney_McKaya at 2007-7-10 2:46:51 > top of Java-index,Security,Cryptography...