Skip to content

Instantly share code, notes, and snippets.

@Neoglyph
Created December 17, 2018 08:33
Show Gist options
  • Save Neoglyph/b2bf7ea2ca7c0ce21ae2b9ec95af0404 to your computer and use it in GitHub Desktop.
Save Neoglyph/b2bf7ea2ca7c0ce21ae2b9ec95af0404 to your computer and use it in GitHub Desktop.
Simple shell script to resize images to specific sizes with imagemagick
shopt -s nullglob
for i in *.png; do
echo "Resizing $i"
FILE=$i
FILENAME="${FILE%%.*}"
EXT="${FILE##*.}"
convert $FILE -resize 270x "./resized/${FILENAME}-270.${EXT}"
convert $FILE -resize 320x "./resized/${FILENAME}-320.${EXT}"
convert $FILE -resize 560x "./resized/${FILENAME}-560.${EXT}"
convert $FILE -resize 800x "./resized/${FILENAME}-800.${EXT}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment