Skip to content

Instantly share code, notes, and snippets.

@gree2
Created August 3, 2012 03:09
Show Gist options
  • Save gree2/3243986 to your computer and use it in GitHub Desktop.
Save gree2/3243986 to your computer and use it in GitHub Desktop.
Python: PPMConverter
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"
@gree2
Copy link
Author

gree2 commented Aug 3, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment