Skip to content

Instantly share code, notes, and snippets.

@greymeister
Created February 12, 2015 19:30
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 greymeister/9d5b4fc66aae8296f8d0 to your computer and use it in GitHub Desktop.
Save greymeister/9d5b4fc66aae8296f8d0 to your computer and use it in GitHub Desktop.
Resize PNG files to 50x80
#!/bin/bash
export pad="60"
printf "%-${pad}s" "Counting files:"
echo `ls -1 | wc -l`
#printf "%-${pad}s" "Create copies of .png files"
# for filename in *.png; do cp "$filename" "${filename}_big.png"; done && echo "done"
#
# printf "%-${pad}s" "Create copies of .PNG files"
# for filename in *.PNG; do cp "$filename" "${filename}_big.png"; done && echo "done"
printf "%-${pad}s" "Resize each product image to 50x80"
for filename in *.*
do
cp "$filename" "${filename}_original"
convert -filter Lanczos -posterize 6 -quality 100 "$filename" -resize 50x80\> "${filename}" > /dev/null 2>&1
done && echo "done"
# cleanup
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment