change "GPS Img Direction" by 180 degree

Started by wildwalks, June 05, 2014, 03:24:39 AM

Previous topic - Next topic

wildwalks

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 :)

Phil Harvey

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

wildwalks

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 :)

Phil Harvey

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

wildwalks