Pass integers instead of floats to PIL's transform method

This commit is contained in:
Roberto Rosario
2011-08-11 04:09:02 -04:00
parent 4d33cec7b2
commit 501d1c0d9d

View File

@@ -110,7 +110,7 @@ class ConverterClass(ConverterBase):
im = self.resize(im, (width, height)) im = self.resize(im, (width, height))
elif transformation['transformation'] == TRANSFORMATION_ZOOM: elif transformation['transformation'] == TRANSFORMATION_ZOOM:
decimal_value = float(arguments.get('percent', 100)) / 100 decimal_value = float(arguments.get('percent', 100)) / 100
im = im.transform((im.size[0] * decimal_value, im.size[1] * decimal_value), Image.EXTENT, (0, 0, im.size[0], im.size[1])) im = im.transform((int(im.size[0] * decimal_value), int(im.size[1] * decimal_value)), Image.EXTENT, (0, 0, im.size[0], im.size[1]))
elif transformation['transformation'] == TRANSFORMATION_ROTATE: elif transformation['transformation'] == TRANSFORMATION_ROTATE:
# PIL counter degress counter-clockwise, reverse them # PIL counter degress counter-clockwise, reverse them
im = im.rotate(360 - arguments.get('degrees', 0)) im = im.rotate(360 - arguments.get('degrees', 0))