Created
April 4, 2017 16:34
-
-
Save Zemnmez/9dd9a11f51454f15d631e5491f182cc2 to your computer and use it in GitHub Desktop.
resizes a target image (can be gif) to given formats usage ./sizes.sh in.gif 10x20 20x40
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 | |
set -e | |
originalSize="$(identify -format "%wx%h\n" $1|head -1)" | |
tmp="${1%%.*}-temp.${1#*.}" | |
convert $1 -coalesce -layers Optimize "$tmp" | |
for SZ in "${@:2}"; do | |
convert -size "$originalSize" "$tmp" -resize "$SZ" \ | |
"${1%%.*}-$SZ.${1#*.}" | |
done | |
rm "$tmp" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment