im = Image.open(srcImage) # might be png, gif etc, for instance test1.png im.thumbnail(size, Image.ANTIALIAS) # size is 640x480 im.save(targetName, "JPEG") # targetname is test1.jpg
produces an exception. Any clues?
The problem is that test1.png is a paletted image, and JPEGs can only hold true-color images. Try changing the last line to:
im.convert('RGB').save(targetName, 'JPEG') -- http://mail.python.org/mailman/listinfo/python-list