ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: tedition on August 30, 2011, 07:59:26 AM

Title: Writting metadata to all images from a CSV file on Mac
Post by: tedition on August 30, 2011, 07:59:26 AM
I am trying to organize my photo library, I have thousands of photographs mostly CR2 and DNG images. I use and like Lightroom 3, I am not an advanced user of Lightroom. I am just getting introduced to AppleScripts, Automator and I found ExifTool by searching on Google. Very impressed on how much it can do. Thumbs up to Phil

Here is what I want to Achieve

During photoshoot i want to create a csv file on my iPhone or iPad that looks something like the following

FileName,Description,Comment,Keyword

and then when I come home I want to put all pictures from a photo shoot in a folder and have exiftool write metadata from the CSV file to pictures based on their filesnames.

After the above is done I will import these pics to my lightroom catalog and be able to use the metadata for organizing them.

Thank you for your kind assistance


Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: Phil Harvey on August 30, 2011, 11:39:43 AM
This is simple.  From the Terminal, you would do the following:

1) cd "name of directory containing images and csv file"

2) exiftool -csv="name of csv file" .   <-- don't forget the "." -- it stands for the current directory

Just one minor point:  The first column of the .CSV file must be "SourceFile", not "FileName".  All other columns must be labelled according to the tag you want to write.

This should be fairly easy to build into an automator action or AppleScript if you want.

- Phil
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: tedition on August 30, 2011, 04:58:50 PM
Dear Phil,

Thank you for your prompt response, I am going to try this and post back with results.

Thank you again for creating this wonderful utility.

regards,
Tom
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: tedition on August 31, 2011, 02:44:34 PM
Works like a charm! Thank you.
I just have a question.

1. In order for the command to work I had to add "./" as prefix to each SourceFile. Is there anyway to avoid it.
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: Phil Harvey on September 01, 2011, 07:15:26 AM
Good point.  I had missed this.

The SourceFile must be specified exactly the same as the file names on the command line, which will include the directory if a directory is specified.

To avoid the ".", specify the next level of directories, or the image file names directly on the command line (using wildcards is fine, ie. "*.jpg").

For the next exiftool release (8.64) I'll look into adding some logic so that "file.jpg" matches "./file.jpg" in the .CSV import.

- Phil

Edit: I am done adding the new logic to also key on canonical file path when looking for a matching SourceFile from the .CSV import.  I've tested it on OS X, and it seems to work well.  Look for this update in ExifTool 8.64 when it is released
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: tedition on September 01, 2011, 06:22:24 PM
eternally grateful, thank you!
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: kskpatra on November 03, 2011, 12:16:43 PM
I am interesting to for that action.
Can you give me more instractions how to syntax the csv file.

I want the Caption for IPTC informations and i use this in the csv file
Code: [Select]
SourceFile,Caption
./_DSC6888.JPG,TestCaption1
./_DSC6889.JPG,TestCaption2

but nothing happend.

the syntax of the command prompt is
Code: [Select]
exiftool.exe -csv=csv_file.csv .
I have the exiftool.exe and the csv_file.csv and the pics in the same directory.
Thanks.

I just saw that the Title respond to Mac user and i use Windows
Can you help me with this?
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: Phil Harvey on November 03, 2011, 01:00:10 PM
Sure I can help.  This should work, although I think you probably want to write a more common tag like IPTC:Caption-Abstract or XMP-dc:Description instead of XMP-acdsee:Caption.  It would help if you answered a few questions:

1) what messages do you get when you run the command (try using the -v2 option if you don't get any useful messages)?

2) what is your operating system and exiftool version number?

Here is what I get on my system here (a Mac):

Code: [Select]
> cat a.csv
SourceFile,Caption
./a.jpg,TestCaption1

> ls -l a.jpg
-rw-r--r--   1 phil  phil  4065022 Nov  3 13:02 a.jpg

> exiftool -ver
8.69

> exiftool -csv=a.csv a.jpg -v2
======== a.jpg
Writing XMP-acdsee:Caption
Rewriting a.jpg...
  Editing tags in: APP1 XMP
  Creating tags in: APP1 XMP
Creating APP1:
  Creating XMP
    + XMP-acdsee:Caption = 'TestCaption1'
JPEG DQT (130 bytes):
JPEG DHT (416 bytes):
JPEG SOF0:
JPEG SOS
    1 image files updated

- Phil
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: IXix on November 12, 2011, 09:18:35 AM
Hi Phil, thanks for exiftool, it looks really powerful but I'm struggling with csv operations. I want to use csv files to append keywords to a list of files but I think I'm having the same problem as kskpatra above. I'm using exiftool 8.69 on Windows 7.

My csv looks like this...
Code: [Select]
SourceFile,iptc:keywords
C:/Users/IX/Pictures/Photo/2007-12/0010.jpg,Test
C:/Users/IX/Pictures/Photo/2008-04/2008.04.15 16-51-01 - 15042008157.jpg,Test

and on the command line I use this...
Code: [Select]
exiftool.exe -csv=csvfile.csv
...but exiftool just prints out the usage instructions as if I hadn't passed any arguments. None of the files in the list have their metadata altered. Specifying -v2 doesn't provide any extra information either.

I thought it might be permissions related but this command works fine...
Code: [Select]
exiftool -iptc:keywords+=Test C:\Users\IX\Pictures\Photo\2007-12\0010.jpg
What could be going wrong? Any help would me much appreciated. If I can't get the csv command to work I could set up a batch/powershell script to do the files one by one but I've got around 3,500 images to process and I'd rather do it the smart way.

Thanks.
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: Phil Harvey on November 12, 2011, 03:21:18 PM
The confusion is because exiftool processes the files listed on the command line, and looks these up in the CSV database to get the tags to write.  So the command should be something like this:

exiftool -csv=csvfile.csv -r C:/Users/IX/Pictures/Photo

- Phil
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: IXix on November 12, 2011, 03:27:50 PM
The confusion is because exiftool processes the files listed on the command line, and looks these up in the CSV database to get the tags to write.
Ah, of course! Now you say it I can see it in your previous reply. Thankyou. At least this might help others who make the same stupid mistake.

Thanks again for the excellent tool.
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: Phil Harvey on November 12, 2011, 04:10:24 PM
I just noticed that you want to append the new keywords to the existing list.  For this, you should use -csv+=csvfile.csv.

- Phil
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: IXix on November 12, 2011, 05:51:20 PM
I just noticed that you want to append the new keywords to the existing list.  For this, you should use -csv+=csvfile.csv
Heh, yeah. Took me a few minutes but I managed to figure that one out by myself. Hope springs eternal!
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: tdiaz on December 09, 2011, 04:24:33 PM
I'm another one of those "have thousands... " with a (soon to be) CSV file and will be doing a massive import into Aperture or Lightroom.  Both stuff that's been sorted/provided to me and what I'm doing myself, to get an absolute crapton of pictures into a referenced library structure.

What I have so far- a whole lot of directories and photos with a file as such that has three columns. Filename, Names and Descriptions. (See the image below)

I'd like the names to get into the keyword field and the description to get into the caption.

Will the comma's are going to cause issues,  perhaps I had need to export these enclosed those with quotes.. or figure out JSON? I've never heard of that format until reading it here.

I'll be renaming the Pic ID as SourceFile, Names as IPTC:keywords and Description as IPTC:caption and where I'm doing my own, start that way.  If I want to add an event name in there, it would be using some other field .. I just need to see what IPTC files Aperture puts stuff in I guess.. .

If I go to each directory in terminal and do this:
Code: [Select]
exiftool -csv+=2003XXX.csv -r .

What will happen with the file time/datestamps? Will they stay the same, or become [now] when it's done?

(http://17500mph.com/ForumAttach/ImageExample.png)
(I see that the example I chose has some incorrect entries.. )
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: Phil Harvey on December 09, 2011, 07:06:34 PM
If you have a question about the CSV format, try setting the tags for one file manually then use the exiftool -csv option to extract these tags. You will see that values with commas are quoted.

Use the -P option if you want to preserve the filesystem modification date/time.  If your filesystem supports a file creation date (standard OS X filesystems do), this is only preserved if you use the -overwrite_original_in_place option.  See FAQ 24 (https://exiftool.org/faq.html#Q24) for details.

- Phil
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: tdiaz on December 21, 2011, 05:47:41 PM
Getting delimiters qualifiers into the CSV files from Excel seems challenging.. especially for Mac. Had to use OpenOffice ..

OTOH, I'm only getting keywords to update. Headline, Title & Description are not making it into the file.

I did export one photo with a bunch of pre-populated bogus data to get the right stuff.  Do the fields need to be in any order?

Attached is a screen shot of both the spreadsheet and csv output
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: Phil Harvey on December 21, 2011, 08:34:09 PM
Why do you say the other tags are not making it into the file?  What software are you using to read them?  My guess is that this is FAQ number 3 (https://exiftool.org/faq.html#3).

The order doesn't matter.

- Phil
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: tdiaz on December 21, 2011, 10:34:38 PM
I pretty much did that - I used another tool, Aperture, to write some stuff. Then I extracted metadata from that photo with ExifTool and chose the fields I wanted to write back to, made my file, and wrote.

When I look with both Photo Mechanic, Aperture and even Finder Get Info- the information is not there at all. Just the keywords.  Finder's Get Info will show me all of those fields, so will Preview.app

Hmmm...   
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: tdiaz on December 22, 2011, 01:46:03 AM
In Aperture - I entered data in the fields I'm interested in:

As they are titled in Aperture:
Caption
Keywords
Copyright Notice
Title
Headline
Image Location
Image City
State/Province
Image Country

In the file I exported, I found data in the following fields (duplicates on the same line)

Caption-Abstract & Description
Subject & Keywords
CopyrightNotice & Rights
ObjectName & Title
Headline
Province-State & State
Country-PrimaryLocationName & Country

In my CSV file I imported the fields Description, Title, Headline, City & Keywords and only Keywords worked.

Headline is the only one that has no duplicate- and it will export data from that field, that I placed there with Aperture. But it will not import data to that field.

I changed the field names to their counterpart duplicates - and did this:
Code: [Select]
ICBM:1999 0904 CAP Sq47 Carrier Tour tdiaz$ exiftool -csv+=stennis.csv -P -overwrite_original_in_place -r .
No SourceFile './DSCN4585 (1).jpg' in imported CSV database
(canonical path: '/Volumes/Event Horizon/Photo Library Import/CAP D13/1999 0904 CAP Sq47 Carrier Tour/DSCN4585 (1).jpg')
    1 directories scanned
    8 image files updated
...and got the identically same result. No data shows other than keywords.  (The image DSCN4585 is not in my CSV file, the other 7 are)
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: Phil Harvey on December 22, 2011, 07:05:54 AM
I have a couple of questions:

1) Did you verify using ExifTool that the information was written?

2) Did you read the last paragraph of FAQ number 3?

- Phil
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: tdiaz on December 22, 2011, 02:28:18 PM
On #1 - Yes, I see no such information. But.. if I look at the same

This one was done, using the above CSV example, that was derived with a -csv . >output.txt as the basis, by doing:
exiftool -csv+=stennis.csv -P -overwrite_original_in_place -r -use MWG .

...and the result is below:

Code: [Select]
ICBM:1999 0904 CAP Sq47 Carrier Tour tdiaz$ exiftool -a -G1 chowline.jpg
[ExifTool]      ExifTool Version Number         : 8.71
[System]        File Name                       : chowline.jpg
[System]        Directory                       : .
[System]        File Size                       : 242 kB
[System]        File Modification Date/Time     : 1999:09:04 11:52:02-07:00
[System]        File Permissions                : rw-r--r--
[File]          File Type                       : JPEG
[File]          MIME Type                       : image/jpeg
[File]          Exif Byte Order                 : Big-endian (Motorola, MM)
[File]          Current IPTC Digest             : 6cb77c4c944a8141128211694813108a
[File]          Image Width                     : 896
[File]          Image Height                    : 600
[File]          Encoding Process                : Baseline DCT, Huffman coding
[File]          Bits Per Sample                 : 8
[File]          Color Components                : 3
[File]          Y Cb Cr Sub Sampling            : YCbCr4:2:2 (2 1)
[IFD0]          Make                            : RICOH
[IFD0]          Camera Model Name               : RDC-5000
[IFD0]          Orientation                     : Horizontal (normal)
[IFD0]          X Resolution                    : 72
[IFD0]          Y Resolution                    : 72
[IFD0]          Resolution Unit                 : inches
[IFD0]          Y Cb Cr Positioning             : Co-sited
[IFD0]          Copyright                       : (C) by RDC-5000 User
[ExifIFD]       Exif Version                    : 0210
[ExifIFD]       Date/Time Original              : 1999:09:04 11:52:02
[ExifIFD]       Create Date                     : 1999:09:04 11:52:02
[ExifIFD]       Components Configuration        : Y, Cb, Cr, -
[ExifIFD]       Compressed Bits Per Pixel       : 4
[ExifIFD]       Shutter Speed Value             : 1/45
[ExifIFD]       Aperture Value                  : 2.9
[ExifIFD]       Brightness Value                : 6553.1
[ExifIFD]       Exposure Compensation           : 0
[ExifIFD]       Max Aperture Value              : 2.8
[ExifIFD]       Light Source                    : Unknown
[ExifIFD]       Flash                           : Fired
[ExifIFD]       Focal Length                    : 8.0 mm
[ExifIFD]       User Comment                    :
[ExifIFD]       Flashpix Version                : 0100
[ExifIFD]       Color Space                     : sRGB
[ExifIFD]       Exif Image Width                : 896
[ExifIFD]       Exif Image Height               : 600
[ExifIFD]       Related Sound File              :
[Ricoh]         Firmware Version                : 1.06
[Ricoh]         Red Gain                        : B3
[Ricoh]         Blue Gain                       : 50
[Ricoh]         Green Gain                      : 44
[InteropIFD]    Interoperability Index          : R98 - DCF basic file (sRGB)
[InteropIFD]    Interoperability Version        : 0100
[IFD1]          Compression                     : JPEG (old-style)
[IFD1]          X Resolution                    : 72
[IFD1]          Y Resolution                    : 72
[IFD1]          Resolution Unit                 : inches
[IFD1]          Thumbnail Offset                : 1073
[IFD1]          Thumbnail Length                : 5367
[IPTC]          Keywords                        : Stennis, aviation, cadet_activities, Stennis, aviation, cadet_activities, Stennis, aviation, cadet_activities, Stennis, aviation, cadet_activities
[IPTC]          Application Record Version      : 4
[Photoshop]     IPTC Digest                     : e91625ec0b6c68f7f6686904be13be9e
[XMP-x]         XMP Toolkit                     : Image::ExifTool 8.71
[XMP-dc]        Subject                         : Stennis, aviation, cadet_activities
[Composite]     Aperture                        : 2.9
[Composite]     Image Size                      : 896x600
[Composite]     Shutter Speed                   : 1/45
[Composite]     Thumbnail Image                 : (Binary data 5367 bytes, use -b option to extract)
[Composite]     Focal Length                    : 8.0 mm
ICBM:1999 0904 CAP Sq47 Carrier Tour tdiaz$

This one was done by entering the same data in Aperture and exporting it- and then viewing it here:  All the data shows.

Code: [Select]
ICBM:1999 0904 CAP Sq47 Carrier Tour tdiaz$ exiftool -a -G1 chowline1.jpg
[ExifTool]      ExifTool Version Number         : 8.71
[System]        File Name                       : chowline1.jpg
[System]        Directory                       : .
[System]        File Size                       : 213 kB
[System]        File Modification Date/Time     : 2011:12:22 11:20:30-08:00
[System]        File Permissions                : rw-r--r--
[File]          File Type                       : JPEG
[File]          MIME Type                       : image/jpeg
[File]          Current IPTC Digest             : 37a12b5fc037d9e722759de77094d085
[File]          Exif Byte Order                 : Big-endian (Motorola, MM)
[File]          Image Width                     : 1024
[File]          Image Height                    : 686
[File]          Encoding Process                : Baseline DCT, Huffman coding
[File]          Bits Per Sample                 : 8
[File]          Color Components                : 3
[File]          Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
[JFIF]          JFIF Version                    : 1.01
[JFIF]          Resolution Unit                 : inches
[JFIF]          X Resolution                    : 72
[JFIF]          Y Resolution                    : 72
[IPTC]          Coded Character Set             : UTF8
[IPTC]          Application Record Version      : 2
[IPTC]          Keywords                        : aviation, cadet_activities, Stennis
[IPTC]          Object Name                     : Lunch on the USS John C. Stennis
[IPTC]          Headline                        : USS John C. Stennis Tour 2000
[IPTC]          Caption-Abstract                : Unidentified cadets.
[Photoshop]     IPTC Digest                     : 37a12b5fc037d9e722759de77094d085
[ICC-header]    Profile CMM Type                : Lino
[ICC-header]    Profile Version                 : 2.1.0
[ICC-header]    Profile Class                   : Display Device Profile
[ICC-header]    Color Space Data                : RGB
[ICC-header]    Profile Connection Space        : XYZ
[ICC-header]    Profile Date Time               : 1998:02:09 06:49:00
[ICC-header]    Profile File Signature          : acsp
[ICC-header]    Primary Platform                : Microsoft Corporation
[ICC-header]    CMM Flags                       : Not Embedded, Independent
[ICC-header]    Device Manufacturer             : IEC
[ICC-header]    Device Model                    : sRGB
[ICC-header]    Device Attributes               : Reflective, Glossy, Positive, Color
[ICC-header]    Rendering Intent                : Perceptual
[ICC-header]    Connection Space Illuminant     : 0.9642 1 0.82491
[ICC-header]    Profile Creator                 : HP
[ICC-header]    Profile ID                      : 0
[ICC_Profile]   Profile Copyright               : Copyright (c) 1998 Hewlett-Packard Company
[ICC_Profile]   Profile Description             : sRGB IEC61966-2.1
[ICC_Profile]   Media White Point               : 0.95045 1 1.08905
[ICC_Profile]   Media Black Point               : 0 0 0
[ICC_Profile]   Red Matrix Column               : 0.43607 0.22249 0.01392
[ICC_Profile]   Green Matrix Column             : 0.38515 0.71687 0.09708
[ICC_Profile]   Blue Matrix Column              : 0.14307 0.06061 0.7141
[ICC_Profile]   Device Mfg Desc                 : IEC http://www.iec.ch
[ICC_Profile]   Device Model Desc               : IEC 61966-2.1 Default RGB colour space - sRGB
[ICC_Profile]   Viewing Cond Desc               : Reference Viewing Condition in IEC61966-2.1
[ICC_Profile]   Luminance                       : 76.03647 80 87.12462
[ICC_Profile]   Technology                      : Cathode Ray Tube Display
[ICC_Profile]   Red Tone Reproduction Curve     : (Binary data 2060 bytes, use -b option to extract)
[ICC_Profile]   Green Tone Reproduction Curve   : (Binary data 2060 bytes, use -b option to extract)
[ICC_Profile]   Blue Tone Reproduction Curve    : (Binary data 2060 bytes, use -b option to extract)
[ICC-view]      Viewing Cond Illuminant         : 19.6445 20.3718 16.8089
[ICC-view]      Viewing Cond Surround           : 3.92889 4.07439 3.36179
[ICC-view]      Viewing Cond Illuminant Type    : D50
[ICC-meas]      Measurement Observer            : CIE 1931
[ICC-meas]      Measurement Backing             : 0 0 0
[ICC-meas]      Measurement Geometry            : Unknown (0)
[ICC-meas]      Measurement Flare               : 0.999%
[ICC-meas]      Measurement Illuminant          : D65
[IFD0]          Make                            : RICOH
[IFD0]          Camera Model Name               : RDC-5000
[IFD0]          Orientation                     : Horizontal (normal)
[IFD0]          X Resolution                    : 72
[IFD0]          Y Resolution                    : 72
[IFD0]          Resolution Unit                 : inches
[IFD0]          Software                        : Aperture 3.2.2
[IFD0]          Modify Date                     : 1999:09:04 11:52:02
[IFD0]          Copyright                       : (C) by RDC-5000 User
[ExifIFD]       Exif Version                    : 0210
[ExifIFD]       Date/Time Original              : 1999:09:04 11:52:02
[ExifIFD]       Create Date                     : 1999:09:04 11:52:02
[ExifIFD]       Compressed Bits Per Pixel       : 4
[ExifIFD]       Shutter Speed Value             : 1/45
[ExifIFD]       Aperture Value                  : 2.9
[ExifIFD]       Brightness Value                : 6553.1
[ExifIFD]       Exposure Compensation           : 0
[ExifIFD]       Max Aperture Value              : 2.8
[ExifIFD]       Light Source                    : Unknown
[ExifIFD]       Flash                           : Fired
[ExifIFD]       Focal Length                    : 8.0 mm
[ExifIFD]       Flashpix Version                : 0100
[ExifIFD]       Color Space                     : sRGB
[ExifIFD]       Exif Image Width                : 1024
[ExifIFD]       Exif Image Height               : 686
[XMP-x]         XMP Toolkit                     : XMP Core 4.4.0
[XMP-dc]        Description                     : Unidentified cadets.
[XMP-dc]        Subject                         : Stennis, aviation, cadet_activities
[XMP-dc]        Title                           : Lunch on the USS John C. Stennis
[XMP-photoshop] Headline                        : USS John C. Stennis Tour 2000
[Composite]     Aperture                        : 2.9
[Composite]     Image Size                      : 1024x686
[Composite]     Shutter Speed                   : 1/45
[Composite]     Focal Length                    : 8.0 mm
ICBM:1999 0904 CAP Sq47 Carrier Tour tdiaz$

On the #2, yes, that's why I changed the field names even, and Headline isn't one of the ones covered on your table of overlap, yet keywords is- and keywords is the only thing that is working.
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: tdiaz on December 23, 2011, 12:48:18 AM
Checking one from Photo Mechanic- these are the fields that get added when I entered four things:
Code: [Select]
[IPTC]          Object Name                     : Title From PhotoMechanic VIRIN
[IPTC]          Keywords                        : Keywords from PhotoMechanic
[IPTC]          Caption-Abstract                : Caption from PhotoMechanic
[IPTC]          Headline                        : Headline from PhotoMechanic

[XMP-photoshop] Headline                        : Headline from PhotoMechanic
[XMP-photoshop] Date Created                    : 1999:09:04 11:52:02-08:00
[XMP-dc]        Subject                         : Keywords from PhotoMechanic
[XMP-dc]        Description                     : Caption from PhotoMechanic
[XMP-dc]        Title                           : Title From PhotoMechanic VIRIN

I have tried using any combination of those field names, to no avail - again, except keywords always work and "Headline" has no duplicate field. 

Code: [Select]
-csv+=file.csv -P -overwrite_original_in_place -r -use MWG .Photo Mechanic calls the Title field VIRIN

I even did a dump of a file: exiftool -csv DSCN4585a.jpg  >output1.txt
Then changed the filename inside it, and:
exiftool -csv+=output1.csv -P -overwrite_original_in_place -r -use MWG .

..and checked with exiftool -a -G1 group74.jpg >group74ET.txt
Got the same results, just the keywords were written. Obviously using the exact field names written by ExifTool. :(

Perhaps I'm just blatantly outright missing something here?
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: Phil Harvey on December 23, 2011, 07:26:49 AM
It doesn't sound like you are missing anything.

Could you email me the JPEG and your CSV files so I can reproduce this myself?  (my mail is philharvey66 at gmail.com)

If I can reproduce the problem then I can figure out what is going wrong.

- Phil
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: tdiaz on December 23, 2011, 12:35:03 PM
Email has been sent. :)
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: Phil Harvey on December 23, 2011, 02:06:07 PM
Thanks for the files.

But I don't know what the problem is.  When I used "stennis.csv" to set the metadata for the images you sent, it worked as expected.  First, I changed to the directory containing the images and CSV file (with "cd DIR"), then when I ran the command with the -v2 option, I could see that things were getting written properly for the last 6 files (the first 2 don't have matching filenames in the CSV file, so nothing is done.):

Code: [Select]
> exiftool -csv=stennis.csv . -v2 -use MWG
Reading CSV file stennis.csv
======== ./chowlinePM.jpg
No SourceFile './chowlinePM.jpg' in imported CSV database
(canonical path: '/Users/phil/Desktop/Archive/chowlinePM.jpg')
======== ./DSCN4585a.jpg
No SourceFile './DSCN4585a.jpg' in imported CSV database
(canonical path: '/Users/phil/Desktop/Archive/DSCN4585a.jpg')
======== ./gpsrs.jpg
Setting new values from CSV database
Writing IPTC:Caption-Abstract
Deleting Photoshop:IPTCDigest if value is 'old'
Writing Photoshop:IPTCDigest if tag was deleted
Writing XMP-photoshop:City
Writing IPTC:City if IPTC exists
Writing MIE-Geo:City
Writing Panasonic:City if tag exists
Writing XMP-photoshop:Headline if tag exists
Writing IPTC:Headline
Writing XMP-dc:Subject
Writing IPTC:Keywords if IPTC exists
Writing PostScript:Keywords
Writing PDF:Keywords if tag exists
Writing MIE-Doc:Keywords
Writing XMP-pdf:Keywords if tag exists
Writing XMP-acdsee:Keywords if tag exists
Writing XMP-xmp:Keywords if tag exists
Writing IPTC:ObjectName
Rewriting ./gpsrs.jpg...
  Editing tags in: APP0 APP1 APP13 CIFF ExifIFD IFD0 IPTC JFIF MIE-Doc MIE-Geo MakerNotes PDF Photoshop PostScript XMP
  Creating tags in: APP1 APP13 IPTC MIE-Doc MIE-Geo Photoshop PostScript XMP
JPEG APP1 (6423 bytes):
  Rewriting IFD0
  ExifByteOrder = MM
  Rewriting ExifIFD
  Rewriting InteropIFD
  Rewriting IFD0
Creating APP13:
  Creating Photoshop
  Creating IPTC
    + IPTC:ObjectName = 'Group shot of CAP Senior members at the USS John C. Stennis tour'
    + IPTC:Keywords = 'Stennis, aviation, cadet_activities'
    + IPTC:City = 'San Diego'
    + IPTC:Headline = 'USS John C. Stennis Tour 2001'
    + IPTC:Caption-Abstract = 'Senior Member Gina Gray, George Pruitt, Ben Peterson[snip]'
    + IPTC:ApplicationRecordVersion = '4' (mandatory)
    + Photoshop:IPTCDigest = '...;..._...f....'
Creating APP1:
  Creating XMP
    + XMP-photoshop:City = 'San Diego'
    + XMP-dc:Subject = 'Stennis, aviation, cadet_activities'
JPEG DQT (130 bytes):
JPEG DHT (416 bytes):
JPEG SOF0:
JPEG SOS
======== ./group74.jpg
Setting new values from CSV database
Writing IPTC:Caption-Abstract
Deleting Photoshop:IPTCDigest if value is 'old'
Writing Photoshop:IPTCDigest if tag was deleted
Writing XMP-photoshop:City
Writing IPTC:City if IPTC exists
Writing MIE-Geo:City
Writing Panasonic:City if tag exists
Writing XMP-photoshop:Headline if tag exists
Writing IPTC:Headline
Writing XMP-dc:Subject
Writing IPTC:Keywords if IPTC exists
Writing PostScript:Keywords
Writing PDF:Keywords if tag exists
Writing MIE-Doc:Keywords
Writing XMP-pdf:Keywords if tag exists
Writing XMP-acdsee:Keywords if tag exists
Writing XMP-xmp:Keywords if tag exists
Writing IPTC:ObjectName
Rewriting ./group74.jpg...
  Editing tags in: APP0 APP1 APP13 CIFF ExifIFD IFD0 IPTC JFIF MIE-Doc MIE-Geo MakerNotes PDF Photoshop PostScript XMP
  Creating tags in: APP1 APP13 IPTC MIE-Doc MIE-Geo Photoshop PostScript XMP
JPEG APP1 (6333 bytes):
  Rewriting IFD0
  ExifByteOrder = MM
  Rewriting ExifIFD
  Rewriting InteropIFD
  Rewriting IFD0
Creating APP13:
  Creating Photoshop
  Creating IPTC
    + IPTC:ObjectName = 'Group Photo of the Carrier Tour 1999'
    + IPTC:Keywords = 'Stennis, aviation, cadet_activities'
    + IPTC:City = 'San Diego'
    + IPTC:Headline = 'USS John C. Stennis Tour 2002'
    + IPTC:Caption-Abstract = 'Unidentified CAP Members, Navy Personnel and family'
    + IPTC:ApplicationRecordVersion = '4' (mandatory)
    + Photoshop:IPTCDigest = '....z.C.$..FIvM.'
Creating APP1:
  Creating XMP
    + XMP-photoshop:City = 'San Diego'
    + XMP-dc:Subject = 'Stennis, aviation, cadet_activities'
JPEG DQT (130 bytes):
JPEG DHT (416 bytes):
JPEG SOF0:
JPEG SOS
======== ./groupintruder.jpg
Setting new values from CSV database
Writing IPTC:Caption-Abstract
Deleting Photoshop:IPTCDigest if value is 'old'
Writing Photoshop:IPTCDigest if tag was deleted
Writing XMP-photoshop:City
Writing IPTC:City if IPTC exists
Writing MIE-Geo:City
Writing Panasonic:City if tag exists
Writing XMP-photoshop:Headline if tag exists
Writing IPTC:Headline
Writing XMP-dc:Subject
Writing IPTC:Keywords if IPTC exists
Writing PostScript:Keywords
Writing PDF:Keywords if tag exists
Writing MIE-Doc:Keywords
Writing XMP-pdf:Keywords if tag exists
Writing XMP-acdsee:Keywords if tag exists
Writing XMP-xmp:Keywords if tag exists
Writing IPTC:ObjectName
[minor] IPTC:ObjectName exceeds length limit (truncated)
Rewriting ./groupintruder.jpg...
  Editing tags in: APP0 APP1 APP13 CIFF ExifIFD IFD0 IPTC JFIF MIE-Doc MIE-Geo MakerNotes PDF Photoshop PostScript XMP
  Creating tags in: APP1 APP13 IPTC MIE-Doc MIE-Geo Photoshop PostScript XMP
JPEG APP1 (6187 bytes):
  Rewriting IFD0
  ExifByteOrder = MM
  Rewriting ExifIFD
  Rewriting InteropIFD
  Rewriting IFD0
Creating APP13:
  Creating Photoshop
  Creating IPTC
    + IPTC:ObjectName = 'Squadron 47 touring an Intruder on the USS John C. Stennis fligh'
    + IPTC:Keywords = 'Stennis, aviation, cadet_activities'
    + IPTC:City = 'San Diego'
    + IPTC:Headline = 'USS John C. Stennis Tour 2003'
    + IPTC:Caption-Abstract = 'Senior Member Mike Woods and unidentified Cadet Members'
    + IPTC:ApplicationRecordVersion = '4' (mandatory)
    + Photoshop:IPTCDigest = 'Wb..k.[......un.'
Creating APP1:
  Creating XMP
    + XMP-photoshop:City = 'San Diego'
    + XMP-dc:Subject = 'Stennis, aviation, cadet_activities'
JPEG DQT (130 bytes):
JPEG DHT (416 bytes):
JPEG SOF0:
JPEG SOS
======== ./groupshot.jpg
Setting new values from CSV database
Writing IPTC:Caption-Abstract
Deleting Photoshop:IPTCDigest if value is 'old'
Writing Photoshop:IPTCDigest if tag was deleted
Writing XMP-photoshop:City
Writing IPTC:City if IPTC exists
Writing MIE-Geo:City
Writing Panasonic:City if tag exists
Writing XMP-photoshop:Headline if tag exists
Writing IPTC:Headline
Writing XMP-dc:Subject
Writing IPTC:Keywords if IPTC exists
Writing PostScript:Keywords
Writing PDF:Keywords if tag exists
Writing MIE-Doc:Keywords
Writing XMP-pdf:Keywords if tag exists
Writing XMP-acdsee:Keywords if tag exists
Writing XMP-xmp:Keywords if tag exists
Writing IPTC:ObjectName
Rewriting ./groupshot.jpg...
  Editing tags in: APP0 APP1 APP13 CIFF ExifIFD IFD0 IPTC JFIF MIE-Doc MIE-Geo MakerNotes PDF Photoshop PostScript XMP
  Creating tags in: APP1 APP13 IPTC MIE-Doc MIE-Geo Photoshop PostScript XMP
JPEG APP1 (6275 bytes):
  Rewriting IFD0
  ExifByteOrder = MM
  Rewriting ExifIFD
  Rewriting InteropIFD
  Rewriting IFD0
Creating APP13:
  Creating Photoshop
  Creating IPTC
    + IPTC:ObjectName = 'Squadron 47 Gathers before boarding the USS John C. Stennis'
    + IPTC:Keywords = 'Stennis, aviation, cadet_activities'
    + IPTC:City = 'San Diego'
    + IPTC:Headline = 'USS John C. Stennis Tour 2004'
    + IPTC:Caption-Abstract = 'Senior Member George Pruitt, Ben Peterson, Mike Wood[snip]'
    + IPTC:ApplicationRecordVersion = '4' (mandatory)
    + Photoshop:IPTCDigest = '(.'....T...b."n.'
Creating APP1:
  Creating XMP
    + XMP-photoshop:City = 'San Diego'
    + XMP-dc:Subject = 'Stennis, aviation, cadet_activities'
JPEG DQT (130 bytes):
JPEG DHT (416 bytes):
JPEG SOF0:
JPEG SOS
======== ./madridsim.jpg
Setting new values from CSV database
Writing IPTC:Caption-Abstract
Deleting Photoshop:IPTCDigest if value is 'old'
Writing Photoshop:IPTCDigest if tag was deleted
Writing XMP-photoshop:City
Writing IPTC:City if IPTC exists
Writing MIE-Geo:City
Writing Panasonic:City if tag exists
Writing XMP-photoshop:Headline if tag exists
Writing IPTC:Headline
Writing XMP-dc:Subject
Writing IPTC:Keywords if IPTC exists
Writing PostScript:Keywords
Writing PDF:Keywords if tag exists
Writing MIE-Doc:Keywords
Writing XMP-pdf:Keywords if tag exists
Writing XMP-acdsee:Keywords if tag exists
Writing XMP-xmp:Keywords if tag exists
Writing IPTC:ObjectName
[minor] IPTC:ObjectName exceeds length limit (truncated)
Rewriting ./madridsim.jpg...
  Editing tags in: APP0 APP1 APP13 CIFF ExifIFD IFD0 IPTC JFIF MIE-Doc MIE-Geo MakerNotes PDF Photoshop PostScript XMP
  Creating tags in: APP1 APP13 IPTC MIE-Doc MIE-Geo Photoshop PostScript XMP
JPEG APP1 (6383 bytes):
  Rewriting IFD0
  ExifByteOrder = MM
  Rewriting ExifIFD
  Rewriting InteropIFD
  Rewriting IFD0
Creating APP13:
  Creating Photoshop
  Creating IPTC
    + IPTC:ObjectName = 'A Squadron 47 cadet sits at the simulator on the USS John C. Ste'
    + IPTC:Keywords = 'Stennis, aviation, cadet_activities'
    + IPTC:City = 'San Diego'
    + IPTC:Headline = 'USS John C. Stennis Tour 2005'
    + IPTC:Caption-Abstract = 'Unidentified cadet'
    + IPTC:ApplicationRecordVersion = '4' (mandatory)
    + Photoshop:IPTCDigest = '.>z!)..o.C9.....'
Creating APP1:
  Creating XMP
    + XMP-photoshop:City = 'San Diego'
    + XMP-dc:Subject = 'Stennis, aviation, cadet_activities'
JPEG DQT (130 bytes):
JPEG DHT (416 bytes):
JPEG SOF0:
JPEG SOS
======== ./radarhanson.jpg
Setting new values from CSV database
Writing IPTC:Caption-Abstract
Deleting Photoshop:IPTCDigest if value is 'old'
Writing Photoshop:IPTCDigest if tag was deleted
Writing XMP-photoshop:City
Writing IPTC:City if IPTC exists
Writing MIE-Geo:City
Writing Panasonic:City if tag exists
Writing XMP-photoshop:Headline if tag exists
Writing IPTC:Headline
Writing XMP-dc:Subject
Writing IPTC:Keywords if IPTC exists
Writing PostScript:Keywords
Writing PDF:Keywords if tag exists
Writing MIE-Doc:Keywords
Writing XMP-pdf:Keywords if tag exists
Writing XMP-acdsee:Keywords if tag exists
Writing XMP-xmp:Keywords if tag exists
Writing IPTC:ObjectName
Rewriting ./radarhanson.jpg...
  Editing tags in: APP0 APP1 APP13 CIFF ExifIFD IFD0 IPTC JFIF MIE-Doc MIE-Geo MakerNotes PDF Photoshop PostScript XMP
  Creating tags in: APP1 APP13 IPTC MIE-Doc MIE-Geo Photoshop PostScript XMP
JPEG APP1 (6229 bytes):
  Rewriting IFD0
  ExifByteOrder = MM
  Rewriting ExifIFD
  Rewriting InteropIFD
  Rewriting IFD0
Creating APP13:
  Creating Photoshop
  Creating IPTC
    + IPTC:ObjectName = 'Cadets get a look at the radar on the USS John C. Stennis.'
    + IPTC:Keywords = 'Stennis, aviation, cadet_activities'
    + IPTC:City = 'San Diego'
    + IPTC:Headline = 'USS John C. Stennis Tour 2006'
    + IPTC:Caption-Abstract = 'Unidentified cadets'
    + IPTC:ApplicationRecordVersion = '4' (mandatory)
    + Photoshop:IPTCDigest = '..X.[C4ui.0.U..H'
Creating APP1:
  Creating XMP
    + XMP-photoshop:City = 'San Diego'
    + XMP-dc:Subject = 'Stennis, aviation, cadet_activities'
JPEG DQT (130 bytes):
JPEG DHT (416 bytes):
JPEG SOF0:
JPEG SOS
    1 directories scanned
    6 image files updated

And when I read back something (caption-abstract for example), it matches the data in the CSV file for the last 6 files:

Code: [Select]
> exiftool -caption-abstract .
======== ./chowlinePM.jpg
Caption-Abstract                : Caption from PhotoMechanic
======== ./DSCN4585a.jpg
Caption-Abstract                : CAPF 431, Capt. Diaz
======== ./gpsrs.jpg
Caption-Abstract                : Senior Member Gina Gray, George Pruitt, Ben Peterson and an unidentified woman
======== ./group74.jpg
Caption-Abstract                : Unidentified CAP Members, Navy Personnel and family
======== ./groupintruder.jpg
Caption-Abstract                : Senior Member Mike Woods and unidentified Cadet Members
======== ./groupshot.jpg
Caption-Abstract                : Senior Member George Pruitt, Ben Peterson, Mike Woods, Ed Ferrell and unidentified cadets
======== ./madridsim.jpg
Caption-Abstract                : Unidentified cadet
======== ./radarhanson.jpg
Caption-Abstract                : Unidentified cadets

I am using ExifTool 8.73 here, but the results should be the same with 8.71 (which you are using).  Do you get the same results as above when running these same commands on the files you sent?

- Phil
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: tdiaz on December 24, 2011, 12:18:23 PM
Your command examples worked for me as well. Since in the simplest form you did it, it worked I added the rest of my flags and came up with no issues until I set it to append (keywords) instead of replace. Apparently it stumbles on trying to append the rest of the stuff?

Does not work:
Code: [Select]
exiftool -csv+=stennis.csv . -P -overwrite_original_in_place -r -v2 -use MWGWorks:
Code: [Select]
exiftool -csv=stennis.csv . -P -overwrite_original_in_place -r -v2 -use MWG
Removed the '+'

I think one of the things I tried was to remove the keyword column from the file as well. 

Now I'm trying to figure out if there's a different field to use because it seems that Exiftool truncates the title at 64 characters yet Aperture, Lightroom, iPhoto and Photo Mechanic do not.

In looking at specs I see that there is a legacy note for 64 characters on one of the field names that is shared by the same data, but the others all say 2000 characters.

Is there a list for ExifTool and what the max values it works with are?

On keywords, do I want commas separating them, and underscores for spaces when it's more than one word, like is common on forums and such, or do I just leave them all as individual words?

IE: cadet_activities, aviation, flight
or: cadet activities aviation flight

Would ExifTool support any other character as a delimiter except a comma? Like tab? Or a set number of spaces?
Trying to come up with a way of using Excel plainly, as OpenOffice works for saving csv with qualifiers, but is kinda hokey to work with otherwise. Herky-Jerky-Java crap, and does all kinds of weird things with fonts, cell sizes and wrapping when pasting data in. 

The attached screen shot shows a file exported by Aperture as one example of support for more characters, and the other is truncated during processing by Exiftool.
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: Phil Harvey on December 24, 2011, 12:48:51 PM
Does not work:
Code: [Select]
exiftool -csv+=stennis.csv . -P -overwrite_original_in_place -r -v2 -use MWGWorks:
Code: [Select]
exiftool -csv=stennis.csv . -P -overwrite_original_in_place -r -v2 -use MWG

Ah ha!  Excellent!  This isn't functioning as I had intended.  Thanks for sticking with this until we found the problem.  I will fix this in version 8.74.

Quote
Now I'm trying to figure out if there's a different field to use because it seems that Exiftool truncates the title at 64 characters yet Aperture, Lightroom, iPhoto and Photo Mechanic do not.

See the IPTC tag name documentation (https://exiftool.org/TagNames/IPTC.html) for details about this.  (Read the 3rd paragraph)  Or, an alternative is to use XMP instead of IPTC since it doesn't have any length limitations.

Quote
On keywords, do I want commas separating them, and underscores for spaces when it's more than one word, like is common on forums and such, or do I just leave them all as individual words?

Keywords should be stored separately.  You should probably be using -sep ", " on the command line when writing.  See FAQ number 17 (https://exiftool.org/faq.html#Q17) for details.

Quote
Would ExifTool support any other character as a delimiter except a comma? Like tab? Or a set number of spaces?

Yes, this is specified with the -sep option.
 
- Phil
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: tdiaz on December 24, 2011, 03:41:17 PM
Okay, so in reality it's better to just put the keywords in the CSV as "key words like this" - doesn't matter because I have not done those yet.  If I have instances where I do desire there be commas in the keywords I would use -sep "//" and have them be "key, word//like//this" but in this project I don' t think so.. 

The part about the separator that I was commenting on was the use of the global separator. Because some descriptions have commas in them, and Excel is hugely inflexible with it's separated values saving. Importing is one thing, exporting is another. You can specify the Qualifier and Delimiter on an import. You can't add a Qualifier at all on export/save. ..and there's a few VBA solutions for that but none of them work well on Excel 2011.

But you can save a tab or space delimited file from Excel.. spaces wouldn't really work unless you did something like 5 or more just to be sure, but tabs could work.

Thanks for the support, this is an amazingly flexible tool. I really want to have my data embedded in photos, and the original dates intact in the filesystem for purposes of archiving and this allows that. Then I can import into Aperture and have it all done. I could even do work in Aperture and export, and use this to reset dates, where applicable.
Title: Re: Writting metadata to all images from a CSV file on Mac
Post by: Phil Harvey on December 28, 2011, 04:23:29 PM
Version 8.74 is now available, and the -csv+= feature should now work as documented.

Thanks again for helping to track down this bug.

- Phil