Permalink
Browse files

Merge pull request #2052 from uploadcare/rotate-loading

Fix image loading when rotating by 0 deg
  • Loading branch information...
2 parents 37841db + 3185262 commit bc2c933552b7483482243053d9ec5188e0b7a0fb @homm homm committed on GitHub Aug 5, 2016
Showing with 6 additions and 3 deletions.
  1. +1 −1 PIL/Image.py
  2. +5 −2 Tests/test_image_rotate.py
View
@@ -1575,7 +1575,7 @@ def rotate(self, angle, resample=NEAREST, expand=0):
# 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:
@@ -11,11 +11,14 @@ def rotate(im, mode, angle):
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)

0 comments on commit bc2c933

Please sign in to comment.