batch convert iptc fields in lowercase

Started by maxfear, January 08, 2022, 03:05:26 PM

Previous topic - Next topic

maxfear

Hello! I'm new and it's a pleasure to meet you!
I need a suggestion for my works!
I have a photos archive with about 10k images where the iptc fields (headline keywords descriptions author etc....) are in a mess due the lowercase/uppercase of some fileds. What I need is to make them all lowercase in batch, because they are all different (it's a birds photo archive).
Is there a way? I attached a sample from photomechanic software where you can see some fileds.

thanks to all!!!

Max

StarGeek

First, I would suggest running the command in FAQ #3 to see if your data is IPTC IIM/Legacy or IPTC Core/Ext, which is XMP data.  Also to check if you actually do want to lower case everything or just a few select tags.

The basic command would be this, replacing "TAG1/2" with the actual tags you want to lowercase
exiftool -api 'filter=$_=lc($_)' -TagsFromFile @ -TAG1 -TAG2 /path/to/files/

If you do want to lowercase everything, you would use -IPTC:All -XMP:All as the tags in the above command.

This command creates backup files.  Add -Overwrite_Original to suppress the creation of backup files.  Add -r to recurse into subdirectories.
* 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).

maxfear

thanks so much, but I'm not skilled and I'd like to know every details, if I loose the metadata I'll never know the name of some birds  :D
I open the terminal, and then? can you tell me step by step?
I have the archive divided by (an example):
Family:   Picidae
Genus:   Dendrocopos
Species:   D. major
So I will take the family folder and its subdirectory all togheter, all the archive I think it's too much!

Thanks so much!

Max

ps: if who helps me wants a HR image to print just let me know! I'll be glad for the help www.sticca.it

StarGeek

To just view the data that's in the file, open a terminal, type or copy paste this
exiftool -G1 -a -s
Hit space, and then you can drag a file onto the terminal window and then hit enter.  Exiftool will list all the information in the file.

To run the command I listed, you do the same thing, replacing the TAG1/TAG2 parts either with individual tags you decided you wanted to use from the above command or the two options I posted that will lower case everything.  Read about the extra options I linked.

I'd suggest testing first on some copies of your main files and make sure you have proper backups.   The commands I listed will not lose data, but you need to take time to figure out how the terminal works, as teaching use of the terminal is beyond the scope of these forums.  There are plenty of options if you search Google or you favorite search engine.
* 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).

maxfear

Thanks so much!
I think I didn't understand well, I need to batch many pictures toghether (I have folders divided by species).
But I need to understand how I can do it, at now I use terminal just for easy command, never use for this kind of work.
Is there a tutorial for what I need to do?
I need to make all my iptc lowercacase, better if we do it in every tags instead of the most common.
thanks


Phil Harvey

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

maxfear

I try with a test folder, now all tags are lowercase but I got this error:

https://ibb.co/hcc7vDZ
COMMAND: exiftool -api 'filter=$_=lc($_)' -TagsFromFile @ -IPTC:All -XMP:All -overwrite_original /Users/bimac/Desktop/TEST\ EXIFTOOL/PANTHERA\ LEO


Can I do something?

Phil Harvey

It didn't change the NEF files because they didn't contain IPTC or XMP tags, but presumably there were JPG files in the directory that did.

You should add --ext nef to avoid processing the NEF files, or -ext jpg to just process JPG's.

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

maxfear

In the folder there are only nef, no jpgs for the archive, just for export..
The command is right, isn't it? What should I add to make it works? If I open the nef in photomechanic I can see the info.

thanks so much

StarGeek

Quote from: maxfear on January 11, 2022, 08:43:15 AM
In the folder there are only nef, no jpgs for the archive, just for export..
The command is right, isn't it? What should I add to make it works?

The command is correct.  If you open that directory, you'll most likely see XMP sidecar files along side the NEF files.  The output shows that 67 files were updated.  Most programs do not edit RAW files directly, instead creating and editing XMP sidecar files.   Adding the options Phil listed will tell it to skip the NEF files.
* 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).

maxfear

I should save the IPTC in nef from lightroom, then use exiftool, shouldn't I?
I try to "save metadata in files" by lightroom, but on photomechanic nef are still empty without any tag... I think lightroom is the worst app for metadata...
I need the xmp because I have the raw development setting in them, I don't trust in LRCatalog file I prefer to use the xmp so I can use them in a single pic in photoshop.
Command is right, one thing is good!!  :) :) :)

StarGeek

Quote from: maxfear on January 11, 2022, 11:40:37 AM
I try to "save metadata in files" by lightroom, but on photomechanic nef are still empty without any tag

It may be that Photomechanic doesn't even attempt to read XMP data in a NEF.  You might try setting a tag in a NEF with exiftool and see if PM can read it.
* 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).