ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: wildwalks on June 05, 2014, 03:24:39 AM

Title: change "GPS Img Direction" by 180 degree
Post by: wildwalks on June 05, 2014, 03:24:39 AM
Hi All.

I would like to bulk change the "GPS Img Direction" by 180 degrees on a lot on panoramic images.

The values are already populated (just faceing the wrong direction)

is there and easy exiftool command line (linux) to spin these images by 180 degrees (avoiding numbers less then 0 and more then 360)??

thanks

Matt :)
Title: Re: change "GPS Img Direction" by 180 degree
Post by: Phil Harvey on June 05, 2014, 06:56:42 AM
Hi Matt,

Are the directions integral or do they have decimal values?

If integer, this will work:

exiftool '-gpsimgdirection<${gpsimgdirection;$_=($_+180)%360}' FILE

where FILE is one or more file and/or directory names.

But if the values are decimal, we can't use the integer modulus operator, and the expression would be more complicated.

- Phil
Title: Re: change "GPS Img Direction" by 180 degree
Post by: wildwalks on June 05, 2014, 09:13:57 AM
Thanks Phil

Unfortunately they are decimal values.
Is it possible/easy to round it to an integer?  (rounding is perfectly fine - the resolution of the capture is not that high anyway)

thanks

Matt :)
Title: Re: change "GPS Img Direction" by 180 degree
Post by: Phil Harvey on June 05, 2014, 09:18:54 AM
Hi Matt,

The above solution will truncate the decimal part.

To preserve the decimal part, you could do this:

exiftool '-gpsimgdirection<${gpsimgdirection;use POSIX;$_=POSIX::fmod($_+180,360)}' FILE

- Phil

Edit: Note that you must have an exiftool version less than a year old (9.30 or later), to use this advanced formatting feature.
Title: Re: change "GPS Img Direction" by 180 degree
Post by: wildwalks on June 05, 2014, 09:59:19 AM
wonderful -- thanks phil