Last active
June 7, 2018 08:31
-
-
Save hubgit/6183991 to your computer and use it in GitHub Desktop.
Convert a rectangular SVG to a square PNG, with a transparent background
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 | |
# wget https://upload.wikimedia.org/wikipedia/commons/2/25/Open_Access_logo_PLoS_white.svg -O icon.svg | |
for SIZE in 16 32 48 64 128; do | |
convert -background none icon.svg -transparent white -gravity center -resize "$SIZE>x$SIZE" -extent $SIZEx$SIZE icon$SIZE.png; | |
done | |
for SIZE in 16 32 48 64; do | |
convert -background none icon.png -gravity center -resize "$SIZE>x$SIZE" -extent $SIZEx$SIZE icon$SIZE.png; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what kind of shell utility is "convert"? Where can I get it?