Created
August 25, 2019 00:39
-
-
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
This file contains hidden or 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 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