Skip to content

Instantly share code, notes, and snippets.

@jaguerra
Created July 27, 2012 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaguerra/3186708 to your computer and use it in GitHub Desktop.
Save jaguerra/3186708 to your computer and use it in GitHub Desktop.
SH Resize JPG files with size > 1 Mb
#!/bin/bash
find . -name '*.jpg' -type f -size +1M -not -name '*backup*' | while read filename
do
if [ ! -e "$filename.backup.jpg" ]
then
echo "Backup of $filename.backup.jpg"
cp "$filename" "$filename.backup.jpg"
fi
echo "Limpiando datos de perfil $filename"
gm identify "$filename"
gm mogrify +profile "*" "$filename"
done
find . -name '*.jpg' -type f -size +1M -not -name '*backup*' | while read filename
do
echo "Resizing $filename"
gm identify "$filename"
gm mogrify -resize 33% +profile "*" "$filename"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment