ExifTool Forum

ExifTool => Newbies => Topic started by: Porridge on December 02, 2019, 11:30:51 AM

Title: Prefix gpsimgdirection tag
Post by: Porridge on December 02, 2019, 11:30:51 AM
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?
Title: Re: Prefix gpsimgdirection tag
Post by: StarGeek on December 02, 2019, 11:45:13 AM
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 (https://exiftool.org/exiftool_pod.html#n---printConv))
-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.
Title: Re: Prefix gpsimgdirection tag
Post by: Phil Harvey on December 02, 2019, 11:51:14 AM
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
Title: Re: Prefix gpsimgdirection tag
Post by: Porridge on December 02, 2019, 12:02:20 PM
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
Title: Re: Prefix gpsimgdirection tag
Post by: Phil Harvey on December 02, 2019, 12:21:21 PM
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
Title: Re: Prefix gpsimgdirection tag
Post by: Porridge on December 02, 2019, 12:33:52 PM
worked perfectly - thank you

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

Regards

Porridge
Title: Re: Prefix gpsimgdirection tag
Post by: Phil Harvey on December 02, 2019, 12:35:58 PM
Sure.  lots of ways actually.  Here is one:

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

- Phil
Title: Re: Prefix gpsimgdirection tag
Post by: Porridge on December 02, 2019, 12:38:51 PM
wow - ok

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

Regards

Porridge
Title: Re: Prefix gpsimgdirection tag
Post by: Phil Harvey on December 02, 2019, 12:40:11 PM
Search for "advanced formatting feature" in the application documentation (https://exiftool.org/exiftool_pod.html) and this forum for more information.

- Phil