Auto embed filename into JPEG image metadata?

Ask for help and post your question on how to use XnView MP.

Moderators: XnTriq, xnview

foobar123
Posts: 2
Joined: Thu Sep 09, 2021 6:46 pm

Auto embed filename into JPEG image metadata?

Post by foobar123 »

Hi, is there a way to auto-embed the image name into the jpeg metadata?

Clients often want delivered images re-named according to their standard. In order to quickly find the original images in my system, it would be helpful to be able to search metadata for an original filename regardless of what the image name was eventually changed to.

Bonus if this can be done at any time such as after other keywords are already set (maintain current keywords, just add the new one).

Thanks
User avatar
XnTriq
Moderator & Librarian
Posts: 5936
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Auto embed filename into JPEG image metadata?

Post by XnTriq »

Requested but not yet implemented:
michel038 wrote: Fri Sep 07, 2018 1:41 pmI found exiftool doc :

use this parameter :
-IPTC:Headline<${FileName;s/\.[^.]*$//} -overwrite_original -k -r
https://www.igoroseledko.com/renaming-files-with-exiftool/ wrote:It should be noted, though, that adding a tag to a file requires rewriting the entire file, so it adds quite a bit of time to the renaming process. Feel free to drop this step if the original filename is not something you care to remember. And, by the way, if you want to see the available tags in a file, use this command: exiftool -a -G1 -s <FILENAME>

Code: Select all

# Add a tag to the file with that file's filename
exiftool -P -overwrite_original_in_place '-XMP-xmpMM:PreservedFileName<${filename;s/\.[^.]*$//}' "${file_name}"

# Same as above but for all files in the current folder
exiftool -P -overwrite_original_in_place '-XMP-xmpMM:PreservedFileName<${filename;s/\.[^.]*$//}' .

# Same as above but for all file in the current folder and all subfolders
exiftool -P -overwrite_original_in_place '-XMP-xmpMM:PreservedFileName<${filename;s/\.[^.]*$//}' -r .
ExifTool Forum:
User avatar
michel038
Posts: 794
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Auto embed filename into JPEG image metadata?

Post by michel038 »

Since XnViewMp gives a "Tranfer metadata" feature, it's now easy ...

- Select Jpeg's
- Tools, Metadata, Transfer
- +Add, IPTC, Headline (or choose another field like Caption or Credits) as Target field
- Use the drop down menu to choose "Filename" or "Filename without extension" as source.
- Ok
User avatar
XnTriq
Moderator & Librarian
Posts: 5936
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Auto embed filename into JPEG image metadata?

Post by XnTriq »

michel038 wrote: Mon Sep 13, 2021 3:20 pmSince XnViewMp gives a "Tranfer metadata" feature, it's now easy ...
I stand corrected. Thanks for clarifying, michel038 (-:
foobar123
Posts: 2
Joined: Thu Sep 09, 2021 6:46 pm

Re: Auto embed filename into JPEG image metadata?

Post by foobar123 »

This will get me started.

Looks like I have to run the transfer metadata process to capture filename, then add custom keywords, etc.