Bulk exif description change using CSV

Started by Arfa, April 19, 2023, 09:08:43 PM

Previous topic - Next topic

Arfa

Hi,

I am a super newbie and before I get too dug in I thought to ask if what I was primarily after was possible.

Scenario:
I am rebuilding a website in a new format. The image importer uses the "image description" as the caption. I have existing captions in a text file; which can be easily changed to any required format; they are tagged against the image file-name. There are about 4,000 images – in folders with about 50 or so in each. No problem resetting the com line for each folder if necessary.

Is it possible to set a looping, recursive, something? command to grab a caption from the CSV and write it the relevant image exif?

I have poked about searching the forum and find:
Newbies► Modifying Tags with csv file as an input not working
and see:
-csv="tag_modify_list.csv"
so figure there is some hope as regards my case.

I can see that power/options comes with a degree of complexity [I could kind of relate to the last "What People are Saying about ExifTool" :)] and I would be pleased to have your thoughts and/or suggestions.

Thank you.

Phil Harvey

Yes, the -csv= import will do what you want.  All you need is a 2-column CSV a "SourceFile" header for the first column, and a "ImageDescription" header for the description column (assuming you want to write EXIF ImageDescription, but see FAQs 2 and 3 for help determining which tag to write).  The SourceFile entries can be either absolute path names or relative to the working directory.  The command will work recursively if you add -r, eg)

exiftool -csv=descriptions.csv -r DIR

You can get a template CSV file in the correct format like this:

exiftool -csv -ImageDescription -f -r DIR > out.csv

(where all you need to do is replace the dashes with the descriptions you want in out.csv, then run the first command using this as an input file)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

* 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).

Arfa

Thanks for the speedy reply Phil,

This is awesome. Thank you.

I am still in the structural stage of building this website so seriously tied up with 'big picture' challenges. I will take time with a brew and sift through docs etc.

I very much appreciate the links StarGeek – having an entry point really helps.

Its been said before but... I'll be back :)

Arfa

OK, a bit of weekend time with coffee and code...

I run: exiftool(-k).exe (windows)
It loads a page of information... 'Name' - 'Running in Windows' ... etc. down to ...More...
Pressing 'enter' just loads more info.

I type a command... and after reading a few docs I settled on:
exiftool -common -csv "C:\aa-mine\temp\photoExif" > "C:\aa-mine\temp\photoExif\test.csv"with exifTool.exe in the same folder.
press 'enter'
window closes but no output.

I figure I am missing something very basic. My thought is to get the csv format and then I should be able to reverse the process and experiment with importing.

I am sure the path is clear and simple – just can't see it at the mo'

Thank you.

StarGeek

#5
You have to run exiftool from the command line.  When you just click on it from the desktop, it does not open a command shell where you can type in commands.  You have to open a CMD or a PowerShell, but be aware that PS has a lot of idiosyncrasies that don't play well with exiftool.

See Stand-alone version in the Windows GUI for more details.
* 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).

Arfa

Thanks StarGeek,

It has been a long time since I did the 'dos' thing. cd ../ etc. And age... :(

Output as predicted. I am pretty sure, now that I am on the right planet, that I can work it from here.

Thank you so much for your patience.
Arfa