drewnoakes / metadata-extractor

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

IPTC Credit Line is cut off when written with adobe bridge #600

Closed Starstrum closed 1 year ago

Starstrum commented 1 year ago

When parsing through metadata written by adobe bridge the credit line gets cut off even thought the data is still there. I assume this isn't expected behavior, but I see the IIM specification for credit line on iptc.org is limited to 32 bytes https://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata#credit-line.

With metadata written by other writers the full data will come through. I'll attach 2 images below the first one has metadata written with adobe bridge the second one has metadata written with gimp.

jupiter-full-metadata

jupiter-full-metadata2

Edit: Here's some of the code being used to put the metadata into a map for more context

private void populateMetadata(Metadata metadata) {
        for (Iterator<?> di = metadata.getDirectories().iterator(); di.hasNext(); ) {
            Directory directory = (Directory) di.next();

            @SuppressWarnings("unchecked")
            Map<String, String> tags = (Map<String, String>) computeIfAbsent(
                directory.getName(),
                key -> new HashMap<>());

            for (Iterator<?> ti = directory.getTags().iterator(); ti.hasNext(); ) {
                Tag tag = (Tag) ti.next();

                try {
                    tags.put(tag.getTagName(), directory.getDescription(tag.getTagType()));
                } catch (Exception error) {
                    errors.add(error);
                }
            }
        }
    }
paperboyo commented 1 year ago

Check XMP’s photoshop:credit. It should have the whole thing (I haven’t, though). Bridge is correct to observe the limit when writing to the legacy field. See eg. here (or here) for equivalency between (some) IPTC IIM and (some) XMP fields.

Starstrum commented 1 year ago

Awesome I see it now thank you

drewnoakes commented 1 year ago

@paperboyo thanks very much for your expertise here.

@Starstrum are you willing and able to share those images for our regression test suite in https://github.com/drewnoakes/metadata-extractor-images? It sounds like an edge case we may not yet have covered.

Starstrum commented 1 year ago

@drewnoakes I am is there an official process?

drewnoakes commented 1 year ago

@Starstrum thanks, no you don't have to do anything. I can add them. I just want to make sure you give permission for them to be used in that way.