ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: mjb on April 26, 2024, 06:56:09 AM

Title: ExifTool: storing filename appears to remove some tags
Post by: mjb on April 26, 2024, 06:56:09 AM
Hello

I've been experimenting with storing original file names in image metadata using

exiftool -P "-XMP:PreservedFileName<Filename" "-XMP:Title<Filename" "-IPTC:ObjectName<Filename" "image_file.jpg"

If I then compare metadata for the original and overwritten files, using

exiftool -G "image_file.jpg" > "image_file.txt"

it appears that some metadata is removed. In particular, the line:

[XMP]           Has Extended XMP                : 37B733F57CD6052799E9E5A7B448F0A1

If I compare JPEGsnoop Log files for the same original and overwritten files, it appears that the following metadata is removed:

...
          |        xmlns:hdrgm="http://ns.adobe.com/hdr-gain-map/1.0/"
          |        xmlns:xmpNote="http://ns.adobe.com/xmp/note/"
...
          |      hdrgm:Version="1.0"
          |      xmpNote:HasExtendedXMP="37B733F57CD6052799E9E5A7B448F0A1">
...

Is this meant to happen - have no idea what these lines are for?
Is it possible to retain these lines?
Ideally, I'd like to change the metadata as little as possible.

Any help appreciated

Regards
mjb



Title: Re: ExifTool: storing filename appears to remove some tags
Post by: StarGeek on April 26, 2024, 10:15:38 AM
tl;dr Don't worry about it. It's a bookkeeping tag that is no longer needed after your edit.

From the notes on the XMP-xmpnote (https://exiftool.org/TagNames/XMP.html#xmpNote) group
Quote(this tag is protected so it is not writable directly. Instead, it is set automatically to the GUID of the extended XMP when writing extended XMP to a JPEG image)

Phil will have to verify, but I think exiftool is removing it because it is no longer needed.  Exiftool restructured the data in such a way that the XMP data no longer needed to be written across multiple JPEG blocks (see FAQ #13a, Why is my file smaller after I use ExifTool to write information? (https://exiftool.org/faq.html#Q13)).

To expand further, JPEGs metadata are saved in blocks called APP# (see the JPEG tags page (https://exiftool.org/TagNames/JPEG.html)). The maximum size of these blocks is just under 64KB.  But since metadata can occasionally (Adobe: "Challenge Accepted"*) be bigger than that, the data has to be spread across multiple chunks.

* Adobe routinely massively inflates the XMP data (https://community.adobe.com/t5/photoshop-ecosystem-bugs/p-corrupt-ancestors-tag-in-xmp-causing-giant-file-sizes/idc-p/12672358) with lots of data that is useless when post-processing is done and the final image is exported. See XMP-xmpMM tags (https://exiftool.org/TagNames/XMP.html#xmpMM).
Title: Re: ExifTool: storing filename appears to remove some tags
Post by: mjb on April 26, 2024, 01:52:55 PM
Many thanks for the info. That's all really helpful.

Just to confirm, are the two lines relating to 'hdrgm' equally superfluous?




Windows 10 Home 22H2, ExifTool 12.84
Title: Re: ExifTool: storing filename appears to remove some tags
Post by: Phil Harvey on April 26, 2024, 04:01:19 PM
StarGeek is correct about the HasExtendedXMP tag and its corresponding namespace definition.

But the hdrgm tags are not superfluous, and won't be removed by ExifTool.

- Phil
Title: Re: ExifTool: storing filename appears to remove some tags
Post by: StarGeek on April 26, 2024, 04:52:49 PM
Quote from: mjb on April 26, 2024, 01:52:55 PMJust to confirm, are the two lines relating to 'hdrgm' equally superfluous?

"Tags used in Adobe gain map images" (https://exiftool.org/TagNames/XMP.html#hdrgm)

Up to you if they are needed or not.
Title: Re: ExifTool: storing filename appears to remove some tags
Post by: mjb on April 26, 2024, 06:07:26 PM
Many thanks StarGeek and Phil for your replies.

Perhaps I should have started with I think
Exiftool is a great piece of software and I find it extremely useful.

Re the hdrgm tags, I would like to retain them.

However, as per my original post, for the image I attached, JPEGsnoop reported hdrgm tags present in the original off-camera image, but after using ExifTool to add filename to metadata, the hdrgm tags disappeared.

I don't know if you are able to verify this?

Perhaps the issue is JPEGsnoop is old software?

If ExifTool is not removing them, then could it just be that it refers to them by a different name?

Also, when using ExifTool to list metadata, is it possible to specifically get value of hdrgm tag?

Apologies for my limited understanding.

Regards
mjb
Title: Re: ExifTool: storing filename appears to remove some tags
Post by: StarGeek on April 26, 2024, 06:27:47 PM
Did you check the output from exiftool to see if it's there?  Run this command
exiftool -G1 -a -s -XMP-hdrgm:All file.jpg

The data should still be there, it has just been formatted differently in the raw XMP.

For example, here's how the XMP-hdrgm:Version tag would look normally after editing with exiftool
<rdf:Description rdf:about=''
  xmlns:hdrgm='http://ns.adobe.com/hdr-gain-map/1.0/'>
  <hdrgm:Version>1.0</hdrgm:Version>
 </rdf:Description>

But if you add the -api Compact=All option (https://exiftool.org/ExifTool.html#Compact), you get this
<rdf:Description rdf:about=''
xmlns:hdrgm='http://ns.adobe.com/hdr-gain-map/1.0/'
hdrgm:Version='1.0'/></rdf:RDF>
</x:xmpmeta>

The difference between the two is only visual. They contain the exact same data.
Title: Re: ExifTool: storing filename appears to remove some tags
Post by: Phil Harvey on April 26, 2024, 09:15:40 PM
Maybe update your version of JpegSnoop, and if this doesn't work then file a bug report with them.

- Phil
Title: Re: ExifTool: storing filename appears to remove some tags
Post by: mjb on April 27, 2024, 01:38:20 AM
Many thanks for your last posts - that's got to the bottom of it. Thanks for all your help.


Re ExifTool, what I was missing was this command to output metadata:

exiftool -G1 -a -s  file.jpg

rather than the command I used in my original post


Re JPEGsnoop, I was using version 1.8.0a which appears to have had it last update in 2017.


For StarGeek, back to viewing metadata with ExifTool, using the above command I get the relevant data as:

[XMP-hdrgm]     Version                         : 1.0

How do I get to see the data in the form you displayed? That is:

<rdf:Description rdf:about=''
  xmlns:hdrgm='http://ns.adobe.com/hdr-gain-map/1.0/'>
  <hdrgm:Version>1.0</hdrgm:Version>
 </rdf:Description>

I can see this if I look at XMP data in XnView but how do I see it with ExifTool?

Title: Re: ExifTool: storing filename appears to remove some tags
Post by: mjb on April 27, 2024, 07:00:30 AM
Update:

Further to my last post, I've found this command gives the XMP information I am after:

exiftool -XMP -b file.jpg

Many thanks StarGeek and Phil for your replies.

Regards
mjb