batch-importing iptc data from csv (again)

Started by xanathon, January 25, 2012, 06:54:10 AM

Previous topic - Next topic

xanathon

Hello!

First I want to thank you for this great application. I did already search the forums and looked into the documentation but did not find what I was looking for. Maybe my search terms were faulty so please just point me to the correct documentation info if it already exists...

Problem: I have got a database dump from an typo3 DAM (digital asset management) holding about 3500 images in various formats (mostily jpg and png but also tif, psd, bmp and gif). I extracted the filename and iptc data important to me (title, description, author, copyright notice, keywords) and wrote it into a comma-separated textfile (csv).

My question is: how do I have to format the csv file to batch import the data into the images using exiftool.

I could not find any information about the exact file format in the documentation. Do I have to put the iptc-tagnames into the heading line?

Any help about this would be higly appreciated and thanks in advance.

(I hope I am making sense as english is not my first language)

Phil Harvey

The format for importing into exiftool with -csv=CSVFILE is exactly the same as the format for exporting with -csv.  So try writing the information you want to one file, then exporting with the -csv option (specifying the tags you want to extract), then use this exact format for importing:

exiftool -csv -title -description -author -copyright -keywords FILE

The only trick is list-type tags like Keywords, for which you should add -sep ", " when importing to separate them into individual keywords again.  (or choose another separator when exporting and importing if any keywords contain a comma)

The tag-name heading line of the CSV may contain group name prefixes if you want.  When exporting, add -G or -G1 to add these group names to the exported CSV file.

Hopefully this answers your questions.

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

xanathon

Hi Phil.

Thank you very much for your lightning fast and quite helpful reply!

Pierre

I appreciate that this is a dead topic but I've been going through the discussion and attempting to import metadata via -csv and I get the canonical file error.  I've filename in tried double quotes, single quotes running the following from the image directory...Any Suggestions?

exiftool -csv=input5quotes.csv -ext jpg .

Example from input5quotes.csv
FileName,About,Copyright,CopyrightFlag,CopyrightNotice,CreateDate,Creator,CreatorTool,CropBottomMargin,CropHiSpeed,CropLeftMargin,CroppedImageHeight,CroppedImageLeft,CroppedImageTop,CroppedImageWidth,CropRightMargin,CropTopMargin,CurrentIPTCDigest,CustomPictureStyleFileName,CustomRendered,CustomSettingsAllDefault,CustomSettingsBank,DateTimeOriginal,GPSDateStamp,GPSDateTime,GPSLatitude,GPSLatitudeRef,GPSLongitude,GPSLongitudeRef
"2011-07-24_19-19-34.jpg",This is what it's all about,"Do not use without permission of author  c/o Department of Fisheries and Oceans, Canada",,,2011:07:24 19:19:33,Hilary Moors,,,"Off (3904x2616 cropped to 3904x2616 at pixel 0,0)",,,,,,,,,,Normal,,,2011:07:24 19:19:33,,"2011-07-24 20:19:00,43.851200,,-58.886200,

Phil Harvey

Your input CSV file doesn't seem to have a "SourceFile" column.

The first column must be EXACTLY the same as in the output from this command:

exiftool -csv -ext jpg .

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

Pierre

Phil,
I'm slow but got my test to work.
The files I have may or may not have the tags initialized.  I note that the csv import will not write tags when the file is in that state. I guess I would have to write a script that goes through the 700+ files, initialize the tags that I will be populating, then run the csv import...
suggestions?
Thanks Again...

Phil Harvey

Quote from: Pierre on February 04, 2014, 11:57:05 AM
I note that the csv import will not write tags when the file is in that state.

No.  ExifTool does not check the previous value of a tag when doing a simple assignment.

QuoteI guess I would have to write a script that goes through the 700+ files, initialize the tags that I will be populating, then run the csv import...
suggestions?

Good luck. ;)

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