From 7687ce829e50635838707f5153079fb4d34cd41e Mon Sep 17 00:00:00 2001 From: homm Date: Thu, 2 Jun 2016 11:24:45 +0300 Subject: [PATCH] round results of sin and cos functions because there is no possible float-point value of radians which cos will exactly 0. --- PIL/Image.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PIL/Image.py b/PIL/Image.py index f6aeb4502..ee9f860db 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -1583,10 +1583,10 @@ class Image(object): if expand: import math - angle = -angle * math.pi / 180 + angle = - math.radians(angle) matrix = [ - math.cos(angle), math.sin(angle), 0.0, - -math.sin(angle), math.cos(angle), 0.0 + round(math.cos(angle), 15), round(math.sin(angle), 15), 0.0, + round(-math.sin(angle), 15), round(math.cos(angle), 15), 0.0 ] def transform(x, y, matrix=matrix):