Skip to content

Instantly share code, notes, and snippets.

@Shujito
Created October 5, 2018 07:11
Show Gist options
  • Save Shujito/968db96c23f7d228dc66c68d92887132 to your computer and use it in GitHub Desktop.
Save Shujito/968db96c23f7d228dc66c68d92887132 to your computer and use it in GitHub Desktop.
if [ $1 ]; then FILENAME=$1; else exit; fi
BASENAME=$(basename -- $FILENAME)
NAME=${BASENAME%.*}
convert $FILENAME -auto-orient +profile "*" -write \
"mpr:source" -resize "1080x1080^" -gravity center -crop "1080x1080+0+0" +repage -write "$NAME-1080.jpg" +delete \
"mpr:source" -resize "720x720^" -gravity center -crop "720x720+0+0" +repage -write "$NAME-720.jpg" +delete \
"mpr:source" -resize "540x540^" -gravity center -crop "540x540+0+0" +repage -write "$NAME-540.jpg" +delete \
"mpr:source" -resize "360x360^" -gravity center -crop "360x360+0+0" +repage -write "$NAME-360.jpg" +delete \
"mpr:source" -resize "240x240^" -gravity center -crop "240x240+0+0" +repage -write "$NAME-240.jpg" +delete \
"mpr:source" -resize "120x120^" -gravity center -crop "120x120+0+0" +repage -write "$NAME-120.jpg" +delete \
"mpr:source" "$NAME-original.jpg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment