Skip to content

Commit

Permalink
add exiftool support
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan P.C. McQuen committed Jan 2, 2015
1 parent ea2003d commit 122f0d0
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions imgult
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ EXIFREMOVE=${EXIFREMOVE:-true}
## fancy syntax thanks to B. Watson
OPTLEVEL=${1:-90}

if [ "$EXIFREMOVE" = "true" ]; then
EXTRAJTRANARGS="-copy none"
EXTRAOPTPNARGS="-strip all"
fi

if [ -z "$JPEGTRAN" ]; then
export PATH=/usr/local/Cellar/mozjpeg/*/bin:/opt/libmozjpeg/bin:$PATH
JPEGTRAN="$( which jpegtran )"
Expand All @@ -38,10 +33,20 @@ fi
find . -type f -a \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname \
'*.gif' -o -iname '*.png' \) > imgult-files.txt

## back it up!
if [ "$BACKUPIMAGES" = true ]; then
rsync -avz --files-from=imgult-files.txt $PWD ../imgult-backup-files/
fi

## clear out that exif!
if [ "$EXIFREMOVE" = "true" ]; then
EXTRAJTRANARGS="-copy none"
EXTRAOPTPNARGS="-strip all"
if [ -e exiftool ]; then
cat imgult-files.txt | while read IMGULT_FILE; do exiftool -overwrite_original -all= $IMGULT_FILE; done
fi
fi

grep -i 'jpe\?g$' imgult-files.txt | while read file; do
$JPEGTRAN -verbose $EXTRAJTRANARGS -outfile "$file" "$file"
jpegoptim -m$OPTLEVEL "$file"
Expand Down

0 comments on commit 122f0d0

Please sign in to comment.