ExifTool Forum

ExifTool => Newbies => Topic started by: jb1978 on May 05, 2015, 08:55:40 AM

Title: Move and add metadata to multiple fields
Post by: jb1978 on May 05, 2015, 08:55:40 AM
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! 

Title: Re: Move and add metadata to multiple fields
Post by: Phil Harvey on May 05, 2015, 09:12:43 AM
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
Title: Re: Move and add metadata to multiple fields
Post by: Hayo Baan on May 05, 2015, 09:14:23 AM
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

Title: Re: Move and add metadata to multiple fields
Post by: Phil Harvey on May 05, 2015, 09:21:20 AM
Hayo remembered about writing ImageDescription, which I forgot. :)
Title: Re: Move and add metadata to multiple fields
Post by: jb1978 on May 05, 2015, 09:48:18 AM
Thank you both very much!

I will try it tomorrow. Never had a response in a forum this fast before. Big thumbs up!
Title: Re: Move and add metadata to multiple fields
Post by: jb1978 on May 06, 2015, 10:02:32 AM
Worked perfectly!  ;D

Thanks again!