Re: [Gimp-user] [offtopic] image viewer which can show the location on a map



Here is a bash script that will take an image file and open a link in your browser to the openstreetmap.com site at that location.

It requires that the "exiftool" utility be installed, which you can install e.g. on debian-based systems with:

*sudo apt-get install libimage-exiftool-perl*

Put the following in a file (preferably in a location that is in your executable path), call it something like "locatepic".

*#!/bin/bash**
**sensible-browser `exiftool -c "%.6f" $1 | grep "GPS Position" | sed -r 's/^.*: ([0-9]*\.[0-9]*) ([NS]), ([0-9]*\.[0-9]*) ([EW])/http:\/\/www.openstreetmap.org\/search?query=\1%20\2%2C%20\3%20\4/g'`*

(If your distribution doesn't have "sensible-browser" or you don't like which browser is used by it, you can use "xdg-open" in its place.)

Run this command one time:

*chmod ug+x locatepic*

...to make the file executable. Then run it with:

locatepic /path/to/your/picture.jpg

(Or if the executable is not in your path, use /path/to/locatepic /path/to/your/picture.jpg)

There are various ways to integrate this into your desktop environment (e.g. so you can right-click on an image and choose "locatepic"), but I will leave that as an exercise to the reader. Some useful links:

https://developer.gnome.org/integration-guide/stable/desktop-files.html.en
https://specifications.freedesktop.org/desktop-entry-spec/latest/index.html
https://stackoverflow.com/questions/4824590/propagate-all-arguments-in-a-bash-shell-script?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]