Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a camera (not a cellphone) that inserts gps exif info into pictures.

Fact is: using the "gps on" all time drains the battery. So i thought: what about taking just one picture with gps on, and them at home add this exif info to the others?

I would like to know if there are applications that you know of that can help me in this scenario: having a photo with exif information about gps, copy this same gps info to a batch of another pictures.

(I prefer Linux/Mac solutions, but I accept windows as well. I don't mind if it's a command line application.)

share|improve this question
1  
add comment

1 Answer

up vote 6 down vote accepted

Take a look at ExifTool. It is a swiss army knife of Exif info manipulation, can do what you need, among many other things. It is Windows/Linux/Mac compatible command-line tool and a Perl module as well. Free and open source:

The "-tagsFromFile" Option

A special ExifTool option allows copying tags from one file to another. The command-line syntax for doing this is "-tagsFromFile SRCFILE". Any tags specified after this option on the command line are extracted from source file and written to the destination file. If no tags are specified, then all writable tags are copied. This option is very simple, yet very powerful. Depending on the formats of the source and destination files, some of tags read may not be valid in the destination file, in which case they aren't written.

The following command will change all files in current directory and its children (recursively), copying all GPS-related tags from the file SOURCE.JPG:

exiftool −overwrite_original_in_place -r -tagsFromFile SOURCE.JPG -gps:all .

Another way to do this is to put the following into a script. First parameter passed should be the file to copy GPS coordinates from, and all other parameters are the target files to be updated:

#!/usr/bin/env bash
lon=$(exiftool -s3 -GPSLongitude "$1")
lat=$(exiftool -s3 -GPSLatitude "$1")
exiftool -GPSLongitude="$lon" -GPSLatitude="$lat" "${@:2}"
share|improve this answer
2  
jhead is another very useful utility that may complement ExifTool. –  MikeyB Jan 11 '12 at 22:25
1  
@SomebodystillusesyouMS-DOS: All arguments (items in the $@ array) starting with the 2nd. Also, it's four lines now that I realized that I put a lot of unnecessary (and incorrect) stuff there. (Also, "solved".) –  grawity Jan 11 '12 at 22:34
1  
While you're using the script, I'll keep facedesking over the fact that I totally missed the tagsFromFile option which could've done the same in one line... –  grawity Jan 11 '12 at 22:41
1  
@grawity: I was a bit surprised by your edit :-) –  haimg Jan 11 '12 at 22:50
2  
@grawity and @haimg: exiftool −overwrite_original_in_place -r -tagsFromFile SOURCE.JPG -gps:all . - the -r option recurses into the directory (.), and the -gps:all, well... it's just what I was looking for. I beat you, grawity! :) I think you can edit this post and add this snippet, but remember to warn people to read exiftool --help to understand the other options I gave... thank you all! –  Somebody still uses you MS-DOS Jan 12 '12 at 4:27
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.