LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 12-08-2016, 05:31 AM   #1
Bob Fletcher
Member
 
Registered: Nov 2008
Location: Hinckley UK
Distribution: Manjaro Cinnamon
Posts: 137

Rep: Reputation: 1
Printing location on photos


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?
 
Old 12-08-2016, 07:42 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 17,496
Blog Entries: 28

Rep: Reputation: 5433Reputation: 5433Reputation: 5433Reputation: 5433Reputation: 5433Reputation: 5433Reputation: 5433Reputation: 5433Reputation: 5433Reputation: 5433Reputation: 5433
I'm not sure this will do what you want, but it looks like a it might be a good starting point: http://www.exiv2.org/manpage.html
 
Old 12-09-2016, 04:15 AM   #3
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,203

Rep: Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378
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:

https://developers.google.com/maps/d...everse-example

That's the hard bit.

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.
 
Old 12-09-2016, 04:21 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,203

Rep: Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378
Oh, and for manipulating EXIF data I've found http://www.sno.phy.queensu.ca/~phil/exiftool/ to be very handy.
 
Old 12-09-2016, 05:47 AM   #5
Bob Fletcher
Member
 
Registered: Nov 2008
Location: Hinckley UK
Distribution: Manjaro Cinnamon
Posts: 137

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by TenTenths View Post
Oh, and for manipulating EXIF data I've found http://www.sno.phy.queensu.ca/~phil/exiftool/ to be very handy.
.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.
 
Old 12-09-2016, 06:11 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 21,592

Rep: Reputation: 4163Reputation: 4163Reputation: 4163Reputation: 4163Reputation: 4163Reputation: 4163Reputation: 4163Reputation: 4163Reputation: 4163Reputation: 4163Reputation: 4163
Take a look at convert which is part of the ImageMagick suite and see if the annotate option works for you.
 
Old 12-09-2016, 06:14 AM   #7
Bob Fletcher
Member
 
Registered: Nov 2008
Location: Hinckley UK
Distribution: Manjaro Cinnamon
Posts: 137

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by michaelk View Post
Take a look at convert which is part of the ImageMagick suite and see if the annotate option works for you.
Thanks for that I will have a look, never ran it before would be a good experience.
 
Old 12-09-2016, 08:20 AM   #8
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,203

Rep: Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378
Quote:
Originally Posted by Bob Fletcher View Post
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 View Post
I want something to read the EXIF coordinates
As per my post - EXIFTool
Quote:
Originally Posted by Bob Fletcher View Post
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 View Post
and print the result on the photo
As per my post and also
Quote:
Originally Posted by michaelk View Post
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.
Attached Thumbnails
Click image for larger version

Name:	tagged_20161209_121840.jpg
Views:	14
Size:	7.8 KB
ID:	23727  

Last edited by TenTenths; 12-09-2016 at 08:33 AM.
 
1 members found this post helpful.
Old 12-09-2016, 08:24 AM   #9
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,203

Rep: Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378
Oh, and I'll let you work out the "date" bit yourself.
 
Old 12-09-2016, 12:40 PM   #10
Bob Fletcher
Member
 
Registered: Nov 2008
Location: Hinckley UK
Distribution: Manjaro Cinnamon
Posts: 137

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by TenTenths View Post
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.

Robert...
 
Old 12-09-2016, 03:53 PM   #11
Bob Fletcher
Member
 
Registered: Nov 2008
Location: Hinckley UK
Distribution: Manjaro Cinnamon
Posts: 137

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by TenTenths View Post
Oh, and I'll let you work out the "date" bit yourself.
Can you help further. When I run the script it is returning this error
Code:
./tagit.sh: line 28: jq: command not found
 
Old 12-11-2016, 04:50 AM   #12
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,203

Rep: Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378
Quote:
Originally Posted by Bob Fletcher View Post
Can you help further. When I run the script it is returning this error
Code:
./tagit.sh: line 28: jq: command not found
As per my post
Quote:
Originally Posted by TenTenths View Post
In the example below I use curl and jq - https://stedolan.github.io/jq/ to do the JSON stuff
 
Old 12-11-2016, 07:02 AM   #13
Bob Fletcher
Member
 
Registered: Nov 2008
Location: Hinckley UK
Distribution: Manjaro Cinnamon
Posts: 137

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by TenTenths View Post
As per my post
Code:
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.

Thanks
 
Old 12-11-2016, 10:25 AM   #14
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,203

Rep: Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378
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.
 
Old 12-11-2016, 10:31 AM   #15
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,203

Rep: Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378Reputation: 1378
However, if you have a font file you want to use you can do:

Code:
convert ${FILE} \
    -auto-orient \
    -pointsize 100 \
    -font "/full/path/to/fontfile.ttf" \
    -fill rgba\(0,0,0,1\) \
    -gravity southwest \
    -annotate +10+0 "${ADDRESS}" \
    tagged_${FILE}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Which Software is the Best for Printing Photos VRV Linux - Software 3 09-06-2011 10:55 AM
Printing Photos fusion1275 Linux - Software 6 08-03-2011 08:15 PM
[SOLVED] Slow Linux Printing of Large Sized Photos MBA Whore Linux - Software 2 04-10-2007 10:20 PM
printing photos Mandrake 10.1 supradrvr Linux - General 3 04-03-2005 11:08 PM
High definition photos printing from KDE applications ... tulear Linux - Hardware 0 10-16-2004 04:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration