fix image loading when rotating by 0 deg

This commit is contained in:
homm 2016-08-05 19:20:02 +03:00
parent 4f4c982229
commit 3185262e31
2 changed files with 6 additions and 3 deletions

View File

@ -1572,7 +1572,7 @@ class Image(object):
# Fast paths regardless of filter
if angle == 0:
return self._new(self.im)
return self.copy()
if angle == 180:
return self.transpose(ROTATE_180)
if angle == 90 and expand:

View File

@ -11,11 +11,14 @@ class TestImageRotate(PillowTestCase):
self.assertEqual(out.size, im.size) # default rotate clips output
out = im.rotate(angle, expand=1)
self.assertEqual(out.mode, mode)
self.assertNotEqual(out.size, im.size)
if angle % 180 == 0:
self.assertEqual(out.size, im.size)
else:
self.assertNotEqual(out.size, im.size)
for mode in "1", "P", "L", "RGB", "I", "F":
im = hopper(mode)
rotate(im, mode, 45)
for angle in 90, 270:
for angle in 0, 90, 180, 270:
im = Image.open('Tests/images/test-card.png')
rotate(im, im.mode, angle)