Convert SVG to PNG using inkscape CLI
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 | |
for svg in */*.svg; do | |
width=$(grep -m 1 -o -h 'width="[0-9]\+"' $svg | sed 's/[^0-9]//g') | |
height=$(grep -m 1 -o -h 'height="[0-9]\+"' $svg | sed 's/[^0-9]//g') | |
png=$(echo $svg | sed 's/svg/png/') | |
echo "Converting $svg to $png with size ${width}x${height}" | |
inkscape -w "$width" -h "$height" $svg -o $png 2>/dev/null | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment