I recently posted about a way to remove the GPS information from pictures. I wrote a script that will retain the Date/Time information. It requires jhead.
#!/bin/bash
# Will remove non-essential EXIF from a jpeg
# while retaining Date/Time value. I 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
echo Working on "$img"
# Grab the original date/time
DT=`jhead "$img"|grep 'Date/Time'`
# 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"
done
It accepts image files as arguments. You can pass as many or as few as you feel like. If you’re interested in keeping other non-essential exif data, you might want to look into the jhead argument “-te”.


