ExifTool Forum

ExifTool => Newbies => Topic started by: Arfa on April 19, 2023, 09:08:43 PM

Title: Bulk exif description change using CSV
Post by: Arfa on April 19, 2023, 09:08:43 PM
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.
Title: Re: Bulk exif description change using CSV
Post by: Phil Harvey on April 19, 2023, 09:27:20 PM
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 (https://exiftool.org/faq.html#Q2) 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
Title: Re: Bulk exif description change using CSV
Post by: StarGeek on April 19, 2023, 10:59:22 PM
Useful links
-csv option (https://exiftool.org/exiftool_pod.html#csv-CSVFILE)
FAQ #26 (https://exiftool.org/faq.html#Q26)
Title: Re: Bulk exif description change using CSV
Post by: Arfa on April 20, 2023, 10:23:30 PM
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 :)
Title: Re: Bulk exif description change using CSV
Post by: Arfa on April 22, 2023, 02:19:53 AM
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.
Title: Re: Bulk exif description change using CSV
Post by: StarGeek on April 22, 2023, 02:34:06 AM
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 (https://exiftool.org/#running) for more details.
Title: Re: Bulk exif description change using CSV
Post by: Arfa on April 22, 2023, 04:42:19 PM
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