Import text from a csv file as a new comment to a JPG image

Started by fuchs0302, January 28, 2013, 11:21:11 AM

Previous topic - Next topic

fuchs0302

I want to import text (GPS info WGS84 konvertet to Gaus-Krueger) from a csv file as a new comment to a JPG image.
The order from the file is:
Name;GpsKoordinatensystem;BildRichtung;Breite;Länge;-->Nordkoordinate_GK;Ostkoordinate_GK
DSC00013.JPG;WGS-84;197.73;6.6864655331;50.5752874381;2548669.01568;5604624.29148;
DSC00014.JPG;WGS-84;199.028294;6.6864516120;50.5753076355;2548668.00876;5604626.52908;
Is it possible, that the red text is written as command to the correct JPG file?

Sorry for my bad English
fuchs0302

Phil Harvey

ExifTool will read CSV files, but they must be in the same format as the -csv output.  See the -csv option in the application documentation for details.

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

fuchs0302

Ok! The values must be separated by commas. Thats possible!
Or is a other file format better?

How can I extract the third, sixth and seventh column? What parameters do I need?
In the first column is the name of the JPG where the values must be insert.

I think the parameters beginn with:
exiftool -Comment=........

The rest I don`t know!  :-\


Can you give me an example to extract a column from a csv
and how to use the first column with the JPG-Name to find the correct JPG to insert the values.

Thanks
fuchs0302

Phil Harvey

You can't currently select individual columns from the CSV file.  You need to delete these columns first if you don't want to write this information.

The command to generate the CSV

exiftool -csv FILE > out.csv

Is the inverse of this operation:

exiftool -csv=out.csv FILE

Using the first command will show you how the SourceFile column should be formatted.  You can also add tag names to the first command to generate only the columns you want, like this:

exiftool -comment -csv -f FILE > out.csv

Here I added the -f option to force the column to be generated even if the tag doesn't exist in the file(s).

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

fuchs0302

Now I did it! ;D

I write a batch  with three main parts.
1.
Extracting the GPS- infos in special order
exiftool -r -if "$gpslatitude" -fileOrder gpsdatetime -p D:\programme\GeoTools\ExifTool\Koordinaten1.fmt -d %Y-%m-%dT%H:%M:%SZ *.jpg > Koordinaten_Liste_WGS84.csv
with the file order:
#[HEAD]SourceFile,XPComment
$FileName, _Blickrichtung $gpsimgdirection _Ursprungsystem $gpsmapdatum _ $gpslatitude# _ $gpslongitude# _  Neu GausKrueger

2.
Konverting the gps koordinates from WGS84 to Gaus-Krüger with an external programm. This program can read csv files and you can give a seperator for the columns. After konverting the program write a new csv.
(old file:Koordinaten_Liste_WGS84.csv    new file: koordinaten_liste_gausskrueger.csv)
The problem was to find a different seperator, which made no problems with exiftool. So I used the "_" as separator.
You can see it in the file order!


3.
At last I insert the old and the new koordinates als "XPComment" in the JPG-Files.
exiftool -csv=koordinaten_liste_gausskrueger.csv *.JPG

Thank you verry much for your help!
fuchs0302