ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: ww408 on February 10, 2025, 08:27:45 PM

Title: Should be given a notice when metadata is overwritten
Post by: ww408 on February 10, 2025, 08:27:45 PM
When I download an important image I like to at least tag it with the page URL from which it came (and if anyone has an idea on how images saved from a browser could be automatically tagged as such, let me know). After tagging an image just now, I said to myself, a person like this might have added metadata to her image, and sure enough, it was filled with redundant metadata, including the tag that I wrote. So, that made me realize that I should have been alerted to the fact that I had just erased metadata. When writing to a tag that isn't empty, one could receive a notice, like, "xmp-dc:source data replaced". And there could also be more involved options that one can configure: (1) A prompt to overwrite the metadata, (2) A prompt to append/prepend the new data to the existing metadata.
Title: Re: Should be given a notice when metadata is overwritten
Post by: StarGeek on February 10, 2025, 08:56:15 PM
Quote from: ww408 on February 10, 2025, 08:27:45 PM(and if anyone has an idea on how images saved from a browser could be automatically tagged as such, let me know)

On Windows, you could use the zone_Identifier.config (https://exiftool.org/forum/index.php?msg=76121) and use the ZoneIDHostUrl tag from that. Something like
exiftool -config zone_Identifier.config -E "-Description<ZoneIDHostUrl" "-Description<$Description&#x0a;$ZoneIDHostUrl" /path/to/files/

This attempts to append a new line and the ZoneIDHostUrl to an existing Description. If there isn't already one, then it will copy it directly. See Note #1 under the -TAG[+-^]=[VALUE] option (https://exiftool.org/exiftool_pod.html#TAG---VALUE) as for why this works.

There's probably a file system tag for the Mac that does something similar. See the MacOS tags page (https://exiftool.org/TagNames/MacOS.html).

Note that the ZoneID Alternate Data Stream is only created by browsers, AFAIK. Wget, cURL, various download managers, etc., don't create this from what I've seen.

I doubt that there would be a change to make exiftool more interactive, as that would straight up break scripts. There are plenty of options to avoid overwriting data, such as the -if option (https://exiftool.org/exiftool_pod.html#if-NUM-EXPR) and the -wm (-writeMode) option (https://exiftool.org/exiftool_pod.html#wm-MODE--writeMode), as well as the command structure I listed above.