comparison data/plugin/macro/Image.py @ 500:de15d700d553

macro.Image._transform: exception handler for transpose_func added
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Wed, 17 Feb 2010 13:11:56 +0100
parents 0fc6d8edd693
children 16aa5b518631
comparison
equal deleted inserted replaced
499:25702a913bdd 500:de15d700d553
199 5: lambda image: image.transpose(PILImage.ROTATE_90).transpose(PILImage.FLIP_TOP_BOTTOM), 199 5: lambda image: image.transpose(PILImage.ROTATE_90).transpose(PILImage.FLIP_TOP_BOTTOM),
200 6: lambda image: image.transpose(PILImage.ROTATE_270), 200 6: lambda image: image.transpose(PILImage.ROTATE_270),
201 7: lambda image: image.transpose(PILImage.ROTATE_90).transpose(PILImage.FLIP_LEFT_RIGHT), 201 7: lambda image: image.transpose(PILImage.ROTATE_90).transpose(PILImage.FLIP_LEFT_RIGHT),
202 8: lambda image: image.transpose(PILImage.ROTATE_90), 202 8: lambda image: image.transpose(PILImage.ROTATE_90),
203 } 203 }
204 image = transpose_func[transpose_op](image) 204 try:
205 image = transpose_func[transpose_op](image)
206 except KeyError:
207 pass
205 208
206 buf = StringIO.StringIO() 209 buf = StringIO.StringIO()
207 image.save(buf, output_type) 210 image.save(buf, output_type)
208 buf.flush() # XXX needed? 211 buf.flush() # XXX needed?
209 data = buf.getvalue() 212 data = buf.getvalue()