Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@abhikpal
Created August 9, 2017 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhikpal/824aee001ee3dcc35cba65146145b860 to your computer and use it in GitHub Desktop.
Save abhikpal/824aee001ee3dcc35cba65146145b860 to your computer and use it in GitHub Desktop.
Convert SVG images in a folder to PNG.
import os
import sys
image_folder = sys.argv[1] if len(sys.argv) == 2 else '.'
folder_path = os.path.abspath(image_folder)
svg_images = [os.path.abspath(f) for f in os.listdir(folder_path) if f.endswith('.svg')]
for image_file in svg_images:
filename, ext = os.path.splitext(image_file)
os.system("inkscape -z -e {}.png {}".format(filename, image_file))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment