Prefix gpsimgdirection tag

Started by Porridge, December 02, 2019, 11:30:51 AM

Previous topic - Next topic

Porridge

Hi

I am using exftool to generate a tab delineated text file from a batch of jpg files. The file contains the image file name, Latitude, Longitude and image direction/bearing. I have been successful so far but would like to prefiix every gpsimgdirection tag with the text "A=". Is this possible?

StarGeek

#1
Edit:  Ahh, Phil's comment makes more sense and I think I misunderstood the question.

According to the spec, the GPSImgDirection holds a 64 bit unsigned rational numeral.  You can force whatever value you want into it by adding a hashtag to the end of the tag name or adding -n to the command (see -n (printConv) option)
-GPSImgDirection#="A=0.1"
or
-n -GPSImgDirection="A=0.1"
as long as you recognize that this may cause problems with any software that can read that tag.

The second option may run into problems in cases when writing other tags that have a conversion from human readable values to machine-readable values.  See third example in the above link.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

I'm not sure I understand.

Do you want the "A=" in the output tab-delimited text file?  If so, show me the command you are using and I'll show you how to add this.

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

Porridge

Hi Phil

The command I am using is this

exiftool -n -T -filename -gpslatitude -gpslongitude -gpsimgdirection ./ > Photos.txt

This generates the following text

IMG_20191201_105305.jpg   52.3830909727778   -1.75583398333333   358.75
IMG_20191201_105317.jpg   52.3830909727778   -1.75583398333333   181.29

I would like it to read

IMG_20191201_105305.jpg   52.3830909727778   -1.75583398333333   A=358.75
IMG_20191201_105317.jpg   52.3830909727778   -1.75583398333333   A=181.29

Regards

Porridge

Phil Harvey

OK, try this:

exiftool -n -p "$filename   $gpslatitude   $gpslongitude   A=$gpsimgdirection" ./ > Photos.txt

(although it might be a bit of a challenge getting your desired tab character on the command line between the tag names)

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

Porridge

worked perfectly - thank you

might be pushing my luck but is there a way to remove the ".jpg" from the filename?

Regards

Porridge

Phil Harvey

Sure.  lots of ways actually.  Here is one:

exiftool -n -p "${filename;s/\.\w+$//}   $gpslatitude   $gpslongitude   A=$gpsimgdirection" ./ > Photos.txt

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

Porridge

wow - ok

It will take me a while to understand how that works - but thank you for your assistance

Regards

Porridge

Phil Harvey

Search for "advanced formatting feature" in the application documentation and this forum for more information.

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