Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What I want to do is to print the location and date of where a photo was taken reading the coordinates from the EXIF. If I go and take a picture of say Leicester Clock Tower when ever I view this in my smartphone it will say in the bottom left “Leicester”. I want it to print this to the photo or at least do the same thing when viewing on the desktop.
I have been searching but all I can find is adding location to the EXIF. The closest I have come to is digiKam will display location on a map.
I have installed digiKam, Gimp and Shotwell
Any ideas or help?
You'll need to find out what information is being embeded, you may get lucky and find that a verbose location is being recorded in the EXIF data. If not then you'll need to find some way to get the location decoded from the co-ordinates:
Putting the data ON the image is the easy bit if you've ImageMagick on the server:
Code:
INPATH - The folder your image is in
IMAGE - The image name
TEXT - The text you want to appear
OUTPATH - The folder to store then annotated image in
/bin/convert ${INPATH}/${IMAGE} -auto-orient -pointsize 50 -fill rgba\(255,255,255,0.75\) -gravity southwest -annotate +10+0 "${TEXT}" ${OUTPATH}/${IMAGE}
That will take an image, sort out the rotation based on what's stored in the EXIF then in the "southwest" (bottom left) it'll put the text in with a 10px offset.
.Thank you so much for your reply, however it is not what I was looking for. I want something to read the EXIF coordinates then compare with a Geo-database and print the result on the photo something like Gimp bulk processing plugin or similar on Photoshop. digiKam does this but puts it on a map. I am a member of a group called BillionGraves that uses an app to take photos of headstones for transcription. It reads the Geo-coordinates to print on the camera and the website finding the closest cemetary it was taken. I am sure there are other examples but that uses a similar algorithm. Much like adding a time stamp.
Thank you so much for your reply, however it is not what I was looking for.
Perhaps you didn't bother to read both my posts.
Quote:
Originally Posted by Bob Fletcher
I want something to read the EXIF coordinates
As per my post - EXIFTool
Quote:
Originally Posted by Bob Fletcher
then compare with a Geo-database
Once you've the co-ordinates you can compare them however you like.
As per my post - Google Maps API. In the example below I use curl and jq - https://stedolan.github.io/jq/ to do the JSON stuff
Quote:
Originally Posted by Bob Fletcher
and print the result on the photo
As per my post and also
Quote:
Originally Posted by michaelk
Take a look at convert which is part of the ImageMagick suite
And putting it all together:
Code:
#!/bin/bash
# Author : Grant MacDonald
# Purpose: Add Google Maps reverse Geolocation "best guess" to bottom left of image
# Version: 1.0
# Date : 9/12/2016
# Version History
# 1.0 Initial version
# Usage tagit.sh FILENAME
# Output tagged_FILENAME with the address along the bottom
FILE=$1
MYMAPSKEY="[YOUR GOOGLE API KEY HERE]"
GPS=$(exiftool -gpsposition $1 | awk -F: {'print $2'} | tr -d [\'\",deg] | awk {'print $1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$4$8'})
GPSDEC=$(echo ${GPS} | awk '{if ($9=="NE") {printf ("%.4f,%.4f\n",$1+$2/60+$3/3600,$5+$6/60+$7/3600)} \
else if ($9=="NW") {printf ("%.4f,%.4f\n",$1+$2/60+$3/3600,-($5+$6/60+$7/3600))} \
else if ($9=="SE") {printf ("%.4f,%.4f\n",-($1+$2/60+$3/3600),$5+$6/60+$7/3600)} \
else if ($9=="SW") {printf ("%.4f,%.4f\n",-($1+$2/60+$3/3600),-($5+$6/60+$7/3600))}}' )
MAPSURL="https://maps.googleapis.com/maps/api/geocode/json"
RESULTS=$(curl --silent ${MAPSURL}?latlng=${GPSDEC}&key=${MYMAPSKEY})
ADDRESS=$(echo ${RESULTS} | jq '.results[0].formatted_address' | tr -d [\"])
convert ${FILE} \
-auto-orient \
-pointsize 100 \
-fill rgba\(0,0,0,1\) \
-gravity southwest \
-annotate +10+0 "${ADDRESS}" \
tagged_${FILE}
This takes an input file and creates an output file prefixed with tagged_
Cropped and obscured example using an image taken on my phone is attached.
And before anyone else points it out, yeah, there's no graceful error handling if the API doesn't return a result.
Oh, and I'll let you work out the "date" bit yourself.
Thank you so much for the script, I have not been able to try it yet just got in but I wanted to pass my thanks on to you. I'm afraid I did not look at the links properly or probably misunderstood. I was thinking they were for the editing of the coordinates. Sorry about that and thanks for your patience.
convert: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1368.
Sorry to do this to you but I am out of my competency the only scripting I have done is simple straight forward stuff to save time. I have been looking to try to find how to add a font but got no where. Can you explain to me where the font is set because from my understanding of the error message the “null” means it can’t find it.
That's odd. On my distroI didnt have to specify a font it uses a default. Check the man page for convert or the ImagrMagick documentation. Not near a PC now so cant really check.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.