Author Topic: Prefix gpsimgdirection tag  (Read 337 times)

Porridge

  • Newbie
  • *
  • Posts: 4
Prefix gpsimgdirection tag
« 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?

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3785
Re: Prefix gpsimgdirection tag
« Reply #1 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)
-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.
« Last Edit: December 02, 2019, 11:57:13 AM by StarGeek »
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16687
    • ExifTool Home Page
Re: Prefix gpsimgdirection tag
« Reply #2 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Porridge

  • Newbie
  • *
  • Posts: 4
Re: Prefix gpsimgdirection tag
« Reply #3 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

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16687
    • ExifTool Home Page
Re: Prefix gpsimgdirection tag
« Reply #4 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Porridge

  • Newbie
  • *
  • Posts: 4
Re: Prefix gpsimgdirection tag
« Reply #5 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

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16687
    • ExifTool Home Page
Re: Prefix gpsimgdirection tag
« Reply #6 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Porridge

  • Newbie
  • *
  • Posts: 4
Re: Prefix gpsimgdirection tag
« Reply #7 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

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16687
    • ExifTool Home Page
Re: Prefix gpsimgdirection tag
« Reply #8 on: December 02, 2019, 12:40:11 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).