2000+ Photos Import = Metadata

Started by owner, July 26, 2011, 01:06:57 AM

Previous topic - Next topic

owner

Hello,

I have 2000+ photos. I want to be able to import a .csv file with photo captions directly to individual photos.

can your program do this for me? How exaclty?

Can this program / a plug in be used with Adobe Lightroom 3?

Or do I need to install the program on my server, as I note it has been written in PEARL. How do I use this program?

Any help appreciated. Please PM or Email me.

Phil Harvey

You can import CSV files if they have the proper format.  For example, "test.csv":

SourceFile,ImageDescription
a.jpg,Some caption
b.jpg,Some other caption


with this command

exiftool -csv=test.csv .

will set the ImageDescriptions for a.jpg and b.jpg in the current directory.

You don't need to install Perl.  Use the Mac or Windows version depending on your system.  On a Mac, run the command inside a Terminal window.  On a PC, run it inside a cmd.exe window.

There are ExifTool plug-ins for Lightroom, but I don't know of any that will read CSV files.

I'm not PM-ing the response so that other people may learn from this too.

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

owner

HI, Many thanks for the reply.

I have installed the WIN version and all went well.

I'm still not sure how to import a .csv file which contains 2000+ photo captions, which would be written directly to my images?

How exactly do I set this up?

I have a folder on my desktop (PC) which contains the images. Next need to get captions to those images.

Any help greatly appreciated.

Phil Harvey

For simplicity, it is easiest to work in a top-level directory on your hard disk, say "c:\images".

Here is a step-by-step:


  • Install exiftool for command line use (see the install instructions).

  • Run the Windows "cmd.exe" utility.

  • In the cmd window, type "cd \images" then press RETURN to change to the directory containing the images.  This directory should also contain your .csv file (let's call it "test.csv").

  • In the cmd window, type "exiftool -csv=test.csv ." and press RETURN to import the .csv data into the images.

Note that the .csv file must be in the format mentioned in my previous post, with the first row giving the tag names to write and the first tag name must be SourceFile.

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

owner

Many thanks Phil for the reply. I'm really pleased you can patiently work with me to get this sorted out.

I am having trouble. Would it be possible to do a live-chat with you, so we can 'walk through this together'? Just an idea.

OK. I have followed along exactly to your instructions.

NOTHING is being written to the images.

In my file (.csv) file I have named it "photocaptions.csv". I have put both the .csv file and .jpg images in a folder "Photos" on my C:\ drive . As well as the exiftool = c:\photos

All my images (.jpg) are in folders, containing 20 or so photos. 1 folder (i.e. abc with 20 .jpg images or so). BUT the captions are in one long list, .csv file.

Ideally I want 1 caption to be written to it's specific image.

What do I need to do, to get my .csv file with captions written to my images - if the images are in folders? Or do I need to cut&paste all images into 1 folder, for the .csv file to be written correctly?

My fields in my .csv are this: SourceFile  (containing the image file (IMG_001.jpg)             ImageDescription (containing the photo caption)           = but these are in columns. How do I separate these with a comma ?

More clarification is needed and I sure hope this works, otherwise I have to 'cut & paste' each caption and put it in separatly individually with my photos.

Please help ASAP. Thank you so much.

Phil Harvey

Unfortunately the live chat won't work.

If the images are in sub-directories, then the "SourceFile" column of the .csv file should also contain the directory names.

If you attach the .csv file and cut-and-paste the exiftool output from the cmd window we should be able to solve this quickly. (except that I am leaving work for the day, so I won't be able to check back again here until I get home in a few hours)

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

owner

Thank you Phil.

It seems like I am doing something wrong, because still the captions are NOT been written. I presumme once the captions are written, I can open the photo in a photo editing program, look at properties to see the caption / comment?

In my .csv file I have this:

SourceFile                   ImageDescription
alberta/00450004.JPG   Bow River looking towards downtown Calgary
alberta/00450014.JPG   Heritage Park and the Glenbow Resevoir, Calgary

The folder "alberta" contains the pictures = both photocaptions.csv and folders are in c:\photos

So I open cmd, change dir and go to c:\photos
next I use your command: exittool

Nothing seems to happen. All i see in the cmd window, is description of what the exittool program does. Nothing says the captions have written. I check the image, and no caption.

What I am doing incorrectly? How do I get the captions written?

BogdanH

Hi,

Well, I've tried too (just being curious) and didn't success. My scenario:
Five jpg files in:
d:\aa\xx\img1.jpg
d:\aa\xx\img2.jpg
d:\aa\xx\img3.jpg
d:\aa\xx\img4.jpg
d:\aa\xx\img5.jpg

I've created (text file renamed to) csv in:
d:\aa\test.csv
csv file contains:
SourceFile,ImageDescription
d:\aa\xx\img2.jpg,Second
d:\aa\xx\img4.jpg,Fourth

Now, being in d:\aa, I executed:
d:\aa>exiftool -csv=test.csv .
and got:
1 directories scanned
0 image files read


As for path for images (in csv), I've tried slash, backslash, relative path.. we better wait for Phil  :)

Bogdan

Phil Harvey

#8
owner: Your .csv file isn't formatted properly.  You need commas between the fields, not spaces or tabs.  There may be other problems, but that is the most obvious.  Paste the exiftool output if it doesn't work after fixing the csv file.

bogdan: You have 2 or 3 problems:

1) You didn't specify -r, so exiftool looked only in the d:\aa directory.

2) you must be consistent with the directory specification.  The directories inside the .csv file must match those on the command line.  So you should specify "d:\aa\xx" on the command line instead of ".".  (or d:\aa with -r)
(Edit: this is no longer a problem when using exiftool 8.64 or later.)

3) I'm not sure about the backslashes.  ExifTool may change these to forward slashes, but you will see this in the error messages if it is a problem.

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

BogdanH

I see.. I misunderstood csv usage -I though paths in csv is all what's needed. Now, by using
exiftool -csv=test.csv -r d:\aa
it works as expected.
To complete this csv usage thread.. how to avoid (hide) messages
No SourceFile 'd:\aa\....' in imported CSV database
for each existing file not specified inside csv file?

Bogdan

Phil Harvey

Bogdan: The only way to avoid these warnings is to use -q -q, but that will disable other messages too.

owner: I should have mentioned that a good technique to determine the correct .csv formatting, including the necessary directory names, is to extract the information with the -csv option first, like this:

exiftool -csv -f -imagedescription DIR > out.csv

Where DIR is the name of the directory containing the images.  Add a -r option if some images are in subdirectories of DIR.

This command will create "out.csv" in the proper format.  Just insert the descriptions you want in the "ImageDescription" column when writing with this command:

exiftool -csv=out.csv DIR

The only remaining problem is what information do you want to write?  I have chosen ImageDescription, which is the common EXIF tag, but for maximum compatibility you may want to write MWG:Description instead.

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

owner

Thank you so much for all the help; much appreciated.

OK. I have done what you say Phil, and have created a out.csv file; which worked well - but I don't have any image descriptions included.

Source file provided me with the correct 'path' to the images - but it did not write image descriptions.

Below is what your command did:
exiftool -csv -f -r -imagedescription DIR > out.csv

SourceFile                                                               ImageDescription
c:/photos/alberta/00450004.JPG                                       -

Is there a way to add image descriptions to the .csv file also?

Next, once the .csv file is in the 'right format', I can use this command to write captions to the images, right?
exiftool -csv -r=out.csv

Then presummably each caption (image description) will be writtein automatically the the .jpg image, and then I can open the image, view properties to see the description.

I want to write the image description to the captions.

Phil Harvey

You can either edit the .csv file by hand using a text editor or output a .csv file in this format from your database software.

However, you have the -r option in the wrong place.  It should be:

exiftool -csv=out.csv -r DIR

But try a single file to find out what tag your software displays for the caption.  See if this works:

exiftool -imagedescription=hello test.jpg

If not, change the caption with your software and use exiftool to see where it went, then write this tag instead (this is FAQ 3).

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

owner

Hi,

Thanks for that. I tried that exactly how you said, however it came back saying "No Source File".

Perhaps the easiest thing to do now, is to open Adobe Lightroom and "cut & paste" individual descriptions/captions per photo.

Just can't get your program to work :(.

BogdanH

If I remember correctly, Lightroom is capable to store that info directly in jpg files (if you choose to). Is there a reason why you're not using that option?

Bogdan