Skip to content

Fix GPS extraction for ImageMagick string format#80

Open
hyazinthh wants to merge 1 commit intoLycheeOrg:masterfrom
hyazinthh:master
Open

Fix GPS extraction for ImageMagick string format#80
hyazinthh wants to merge 1 commit intoLycheeOrg:masterfrom
hyazinthh:master

Conversation

@hyazinthh
Copy link
Copy Markdown

@hyazinthh hyazinthh commented Mar 28, 2026

Updates the GPS coordinate regex to account for variations in whitespace.

On my system ImageMagick does not output any whitespace after the commas, making extraction fail with current regex:

$ identify -format "%[EXIF:GPSLatitude]\n" tests/files/mongolia.jpeg 
46/1,53903520/1000000,0/1

I assume this is version dependent but I haven't investigated any further.

$ identify --version
Version: ImageMagick 6.9.12-98 Q16 x86_64 18038 https://legacy.imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(4.5) 
Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png raw tiff webp wmf x xml zlib

Update the GPS coordinate regex to handle variations in whitespace.
Newer versions of ImageMagick appear to omit the space after commas.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant