Skip to content

Difficulty setting GPS tag to DMS data #22

@jhansonxi

Description

@jhansonxi

I can't correctly set GPS tags for latitude (0x0002) or longitude (0x0004). The man page doesn't have an example for this so I'm uncertain if this is a user error or bug. My expectation is that entering the data in the same format as the --list-tags output would suffice but it doesn't. Example:

In 1.jpg set:
0x0002 45, 1, 20.970

cat /etc/issue
Ubuntu 24.04.4 LTS \n \l

apt-cache madison libexif12
libexif12 | 0.6.24-1build2 | http://mirror.cogentco.com/pub/linux/ubuntu noble/main amd64 Packages

exif -v
0.6.22

exif --ifd=GPS -i -m "1.jpg"

0x0000 2.2.0.0
0x0001 N
0x0002 0, 0, 0.0000
0x0003 E
0x0004 0, 0, 0.0000
0x0005 Sea level
0x0006 0.000
0x0007 18:32:17.00
0x0012 WGS-84
0x001d 2026:02:08
ThumbnailSize 10391

exif --ifd=GPS -t 0x0002 --set-value="45, 1, 20.970" "1.jpg" -o "1.jpg.latdms_set"
Too few components specified (need 6, found 3)

Added some parameters to see what happens but the result was some odd "/0" values:

exif --ifd=GPS -t 0x0002 --set-value="45, 1, 20.970, 0, 0, 0" "1.jpg" -o "1.jpg.latdms_set"
Wrote file '1.jpg.latdms_set'.

exif --ifd=GPS -i -m "1.jpg.latdms_set"
0x0000 2.2.0.0
0x0001 N
0x0002 45, 20/0, 0/0
0x0003 E
0x0004 0, 0, 0.0000
0x0005 Sea level
0x0006 0.000
0x0007 18:32:17.00
0x0012 WGS-84
0x001d 2026:02:08
ThumbnailSize 10391

Rearrange the parameters and try again:

exif --ifd=GPS -t 0x0002 --set-value="45, 0, 1, 0, 20.970, 0" "1.jpg" -o "1.jpg.latdms_set"
Wrote file '1.jpg.latdms_set'.

exif --ifd=GPS -i -m "1.jpg.latdms_set"
0x0000 2.2.0.0
0x0001 N
0x0002 45/0, 1/0, 20/0
0x0003 E
0x0004 0, 0, 0.0000
0x0005 Sea level
0x0006 0.000
0x0007 18:32:17.00
0x0012 WGS-84
0x001d 2026:02:08
ThumbnailSize 10391

WUT?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions