Skip to content

Instantly share code, notes, and snippets.

@alexkuang0
Created June 26, 2020 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexkuang0/03d3d89b537a375f1e8252097cd63584 to your computer and use it in GitHub Desktop.
Save alexkuang0/03d3d89b537a375f1e8252097cd63584 to your computer and use it in GitHub Desktop.
Batch converting SVG to PNG
for svg in $(ls ./svg); do
filename=$(echo $svg | cut -d'.' -f1)
convert -background none -density 1000 -resize 1000x svg/$(echo $filename).svg png/$(echo $filename).png
echo [DONE] $filename converted!
done
@alexkuang0
Copy link
Author

Convert all SVG files in svg subdirectory to PNG files (1000x1000 with transparent background) and save them in png subdirectory using ImageMagick®.

Install ImageMagick® before running this script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment