Calling
image = Image.open(data) image.thumbnail((36,36), Image.NEAREST)
will maintain the aspect ratio. But I need to end up displaying th
from PIL import Image import StringIO def thumbnail_image(): image = Image.open("image.png") image.thumbnail((300, 200)) thumb_buffer = StringIO.StringIO() image.save(thumb_buffer, format=image.format) fp = open("thumbnail.png", "w") fp.write(thumb_buffer.getvalue()) fp.close()