drewnoakes / metadata-extractor

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Apache License 2.0
2.53k stars 473 forks source link

Sometimes XMP data tags change names #670

Closed rdkgit closed 2 weeks ago

rdkgit commented 3 weeks ago

Hi!

I'm analyzing some drone images and pulling out the exif metadata and xmp metadata using the java version of library, latest and greatest version. I'm using maven to build from source.

Sometimes I'm finding the resulting tag names are for example:

Camera:Pitch Camera2:Pitch Camera1:Pitch

I can't pin down when/why the tag names sometimes change. Sometimes when I build clean the resulting tags change until next clean build.

Any suggestions where to look to find/fix this?

Thanks,

Bobby

rdkgit commented 3 weeks ago

I should add that in my code, I first get the metadata from input stream.

this.md = ImageMetadataReader.readMetadata(new ByteArrayInputStream(imageData));

Then I retrieve all the metadata and put it into a HashMap<String,String> with tagName being the key.

for (Directory directory : md.getDirectories())  {
               for (Tag tag : directory.getTags())  {
                    String tagName = tag.getTagName();
                    String tagValue = tag.getDescription();
                    String rawTagValue = directory.getString(tag.getTagType());
                     metadata.put(tagName, rawTagValue);
                 }
}
drewnoakes commented 3 weeks ago

In XMP the tag names come from the data itself. Maybe your input files use different names.

rdkgit commented 2 weeks ago

I'll dig more through the XMP code. Having a difficult time reproducing the issue. Its somewhat random.

drewnoakes commented 2 weeks ago

I'll close this for now. If you discover a bug in the library we can revisit.