ExifTool: storing filename appears to remove some tags

Started by mjb, April 26, 2024, 06:56:09 AM

Previous topic - Next topic

mjb

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




StarGeek

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 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?).

To expand further, JPEGs metadata are saved in blocks called APP# (see the JPEG tags page). 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 with lots of data that is useless when post-processing is done and the final image is exported. See XMP-xmpMM tags.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

mjb

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

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

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"

Up to you if they are needed or not.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

mjb

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

StarGeek

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, 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.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

Maybe update your version of JpegSnoop, and if this doesn't work then file a bug report with them.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

mjb

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?


mjb

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