Created
August 9, 2017 07:19
-
-
Save abhikpal/824aee001ee3dcc35cba65146145b860 to your computer and use it in GitHub Desktop.
Convert SVG images in a folder to PNG.
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
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