Skip to content

Instantly share code, notes, and snippets.

@keimina
Created December 14, 2013 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keimina/7954912 to your computer and use it in GitHub Desktop.
Save keimina/7954912 to your computer and use it in GitHub Desktop.
from PIL import Image
import os
filelist = ['foo.jpg', 'bar.bmp', 'zot.png']
for infile in filelist:
outfile = os.path.splitext(infile)[0] + ".jpg"
if infile != outfile:
try:
Image.open(infile).save(outfile)
except IOError:
print "cannot convert", infile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment