Skip to content

Instantly share code, notes, and snippets.

@kmundnic
Last active August 29, 2015 14:05
Show Gist options
  • Save kmundnic/3d20027391c0847b4e41 to your computer and use it in GitHub Desktop.
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
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