Last active
December 13, 2015 21:58
-
-
Save radaniba/4980787 to your computer and use it in GitHub Desktop.
A simple script to convert named PDFs to PNGs of the equivalent name.the use case here is that I had a program that churned out graphs as PDFs (and PDFs only) and needed to include these graphs in another document (webpages in this case). This script takes the PDFs and runs them on the commandline through a simple programs called "sips", naming …
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 sys | |
from os import path, system | |
# for each file | |
for infile in sys.argv[1:]: | |
# extract filename components | |
base, ext = path.splitext (infile) | |
new_name = base + ".png" | |
print "Converting %s to %s ..." % (infile, new_name) | |
system ("sips -s format png \"%s\" --out \"%s\"" % (infile, new_name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment