Last active
August 29, 2015 14:05
-
-
Save kmundnic/3d20027391c0847b4e41 to your computer and use it in GitHub Desktop.
From a directory, select all .svg files and turn them into grayscale using Inkscape. Save as .pdf
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 os | |
import subprocess | |
for filename in os.listdir('.'): | |
if filename[-3:] == 'svg': | |
subprocess.call(["inkscape", | |
"-f", | |
filename, | |
"--verb", | |
"EditSelectAll", | |
"--verb", | |
"org.inkscape.color.desaturate.noprefs", | |
"--verb", | |
"FileSave", | |
"--verb", | |
"FileQuit"]) | |
subprocess.call(["inkscape", | |
"-f", | |
filename, | |
"--export-pdf=" + filename[:-4] + ".pdf"]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment