Skip to content

Instantly share code, notes, and snippets.

@cinhtau
Created May 28, 2017 12:49
Show Gist options
  • Save cinhtau/0ca6432f866c5212ffa8bba52ce4aa7b to your computer and use it in GitHub Desktop.
Save cinhtau/0ca6432f866c5212ffa8bba52ce4aa7b to your computer and use it in GitHub Desktop.
Resize images with ImageMagick for srcset usage for Responsive Designs/Images
#!/usr/bin/env bash
if [ ! $# == 1 ]; then
echo "Missing input param, file name."
exit 1;
fi
sizes=(1280 1024 640 320)
# make sizes readonly
declare -r sizes
for i in "${sizes[@]}"; do
convert $1 -resize "$i"x $i-$1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment