Created
February 10, 2020 17:54
-
-
Save cmpadden/e030c9d18e49eb8b66bbef22d1746407 to your computer and use it in GitHub Desktop.
Generate common PNG sizes from an SVG
This file contains hidden or 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 | |
| # Generate common PNG sizes from an SVG using ImageMagick | |
| SOURCE="example.svg" | |
| SIZES=("16" "32" "64" "128" "256" "512" "1024") | |
| for i in "${SIZES[@]}"; do | |
| DESTINATION="${SOURCE/\.svg/-${i}.png}" | |
| printf "%s\n" "Generating $DESTINATION..." | |
| convert -density 1200 -resize "${i}x${i}" "$SOURCE" "$DESTINATION" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment