Skip to content

Instantly share code, notes, and snippets.

@esron
Created August 25, 2019 00:39
Show Gist options
  • Select an option

  • Save esron/cb6e923461379e8b66bbdcc27e76090c to your computer and use it in GitHub Desktop.

Select an option

Save esron/cb6e923461379e8b66bbdcc27e76090c to your computer and use it in GitHub Desktop.
Python Script to covnert all SVG files in the current directory to PNG
import pathlib
import os
# define the path
currentDirectory = pathlib.Path('.')
# define the pattern
currentPattern = "*.svg"
for currentFile in currentDirectory.glob(currentPattern):
imageName = currentFile.name.split('.')[0]
cmd = f'inkscape -D -z {imageName}.svg -e {imageName}.png'
print('Executing: ' + cmd)
os.system(cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment