You may qualify for free work! See the details
A Bash script that removes Geotags from jpeg files. I like to put pictures of my cats on the internet, but I don't like the idea of sharing the coordinates of my home. This script removes the geotags but retains the other EXIF information. Arguments can be individual jpeg files, or a directory to be recursed.
#!/bin/bash
# Will remove non-essential EXIF from a jpeg while retaining Date/Time value.
# Use it to remove GPS information from pictures I want to put on the internet.
# Created Wed Aug 11 18:43:03 PDT 2010
# For handling spaces. See:
# http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for img in $@; do
file_type=`file -b $img`
file_type=${file_type:0:15}
if [ -d "$img" ]; then
echo "$img" is a directory - recursing
$0 "$img/*"
elif [ $file_type == "JPEG image data" ]; then
# Grab the original date/time
DT=`jhead "$img"|grep 'Date/Time'`
# If the date information started out
# blank, trying to tack it back on
# will result in an error
if [ "$DT" == '' ]; then
continue;
else
# Current format: " Date/Time : yyyy:mm:dd hh:mm:ss"
# jhead requires: yyyy:mm:dd-hh:mm:ss
DT=${DT:15:25}-${DT:25}
# Strip non-essential information
jhead -purejpg "$img"
# Put the date/time back
jhead -mkexif -ts$DT "$img"
fi
else
echo "$img" is not a JPG - ignoring $file_type
fi
done