Skip to main content

Getting metadata from image

1 reply [Last post]
newmanw10
Offline
Joined: 2009-08-17
Points: 0

I am trying to get the metadata for an image.

I know that I can use the reader directly:

metadata = reader.getImageMetadata(0);

But if I use imageio to read in the image and pass in an ImageReadParam i imagine that based upon what I pass as parameters (if I set the dimension the width and height will be different) to the ImageReadParam the metadata that I get from the read will be different than that of the actual image. i.e.

RenderedImage image = ImageReader.readAsRenderedImage(0, readParam);

Is there a way to pass an ImageReadParam to a reader such that the getImageMetadata(0) takes that into account?

Thanks!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
haraldk
Offline
Joined: 2005-05-10
Points: 0

I think the getImageMetadata will (and was designed to) only return the image meta data as stored in the image stream/file.

So, I'm pretty sure the short answer is no.

Also, when you specify image dimensions, either using setSourceRenderSize, setSourceRegion or by subsampling, you already know (or can calculate) the new dimensions of the image. What would you use the dimensions in the metadata for in such a case? If you really need the metadata to match your read image, I guess you could just update it with the new values from your image.

Maybe if you describe your use case in more detail, someone could provide more help.

Best regards,

--
Harald K