Created
August 3, 2012 03:09
-
-
Save gree2/3243986 to your computer and use it in GitHub Desktop.
Python: PPMConverter
This file contains 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, sys | |
import Image | |
ppmDir = "ppm/" | |
jpfDir = "jpg/" | |
for filename in os.listdir(ppmDir): | |
(name, ext) = os.path.splitext(filename) | |
if ".ppm" != ext: | |
continue | |
try: | |
im = Image.open(ppmDir + filename) | |
im.save(jpfDir + name + ".jpg") | |
print "Converting <" + filename + "> ok" | |
except IOError: | |
print "Converting <" + filename + "> error" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Extract Jpg From Pdf