News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Move and add metadata to multiple fields

Started by jb1978, May 05, 2015, 08:55:40 AM

Previous topic - Next topic

jb1978

Hi, I'm new to this forum, and I have tried to find a thread that could fix my problem, but I'm afraid I can't find anything. I really need som help with this.

I have around 8000 images where I have to move a text with the photographers initials and year, from Exif UserComment to Exif Copyright. I also have to add text and change the photographers initals to his or her full name. On top of that I've had the request to move only the year (the digits) to Exif ImageDescription. Then remove the text from Exif UserComment.

What it looks like now:

Exif UserComment: Photo 1998 HT

And how I would like it to look:

Exif Copyright: @ Photo Photografers_full_name/Company_name 1998
Exif ImageDescription: 1998

This is giving me a headache. I've had some success moving text from one field to another, but I don't get how I am supposed to change the order of the words/numbers, add @ and the Company name, replace the initials with the photographers full name, copy only the digits to ImageDescription AND remove the text in UserComment all in one go. Is it even possible?

Help is very much appreciated! 


Phil Harvey

Sure it is possible, but a bit advanced.  A command to do this for these initials is:

exiftool "-copyright<${usercomment;s[^(\w+) (\d+) HT$][@ $1 Photografers_full_name/Company_name $2] or undef $_}" DIR

However, it may be a bit tricky for you to get this working.  The problems are:

1) Quoting may be tricky if you are using a bash shell on Mac or Linux.

2) Getting the character set correct for the copyright symbol may be tricky if you are on Windows.

- 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 ($).

Hayo Baan

This command will achieve what you described. You may need to tweak this if things aren't exactly how you presented them here.

exiftool -Copyright'<${UserComment; s/(.*) (\d{4}).*/© $1 Photografers_full_name\/Company_name $2/}' -ImageDescription'<${UserComment; s/.* (\d{4}).*/$1/;}' -UserComment= 0001.jpg

Note: for Windows, change the single quotes to double quotes and change 0001.jpg to the dir/file you want to process.

Sample run:
$ exiftool -UserComment 0001.jpg
[EXIF:ExifIFD]  User Comment                    : Photo 2014 HT
$ exiftool -Copyright'<${UserComment; s/(.*) (\d{4}).*/© $1 Photografers_full_name\/Company_name $2/}' -ImageDescription'<${UserComment; s/.* (\d{4}).*/$1/;}' -UserComment= 0001.jpg
    1 image files updated
$ exiftool -Copyright -ImageDescription -UserComment 0001.jpg
[EXIF:IFD0]     Copyright                       : © Photo Photografers_full_name/Company_name 2012
[EXIF:IFD0]     Image Description               : 2012

Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

Hayo remembered about writing ImageDescription, which I forgot. :)
...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 ($).

jb1978

Thank you both very much!

I will try it tomorrow. Never had a response in a forum this fast before. Big thumbs up!

jb1978