Last active
May 30, 2021 21:57
-
-
Save agermanidis/b32f6ccca037ee3b066bbffd09037f4e to your computer and use it in GitHub Desktop.
bash script to resize an image to multiple sizes with one command using ImageMagick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: ./resize_many.sh <filename> <sizes...> | |
# e.g. ./resize_many.sh myasset.png 10x10 20x20 30x30 | |
# produces 3 files, myasset10x10.png myasset20x20.png myasset30x30.png | |
fullname=$1 | |
shift; | |
sizes=$* | |
extension="${fullname##*.}" | |
filename="${fullname%.*}" | |
for size in $* | |
do | |
convert $fullname -resize $size $filename$size.$extension | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment