Skip to content

Commit 5b1a9e1

Browse files
authored
Merge pull request #8114 from radarhere/fixme
2 parents d9f97b0 + 0d73721 commit 5b1a9e1

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/PIL/Image.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,7 +2368,7 @@ def rotate(
23682368
angle: float,
23692369
resample: Resampling = Resampling.NEAREST,
23702370
expand: int | bool = False,
2371-
center: tuple[int, int] | None = None,
2371+
center: tuple[float, float] | None = None,
23722372
translate: tuple[int, int] | None = None,
23732373
fillcolor: float | tuple[float, ...] | str | None = None,
23742374
) -> Image:
@@ -2436,10 +2436,7 @@ def rotate(
24362436
else:
24372437
post_trans = translate
24382438
if center is None:
2439-
# FIXME These should be rounded to ints?
2440-
rotn_center = (w / 2.0, h / 2.0)
2441-
else:
2442-
rotn_center = center
2439+
center = (w / 2, h / 2)
24432440

24442441
angle = -math.radians(angle)
24452442
matrix = [
@@ -2456,10 +2453,10 @@ def transform(x, y, matrix):
24562453
return a * x + b * y + c, d * x + e * y + f
24572454

24582455
matrix[2], matrix[5] = transform(
2459-
-rotn_center[0] - post_trans[0], -rotn_center[1] - post_trans[1], matrix
2456+
-center[0] - post_trans[0], -center[1] - post_trans[1], matrix
24602457
)
2461-
matrix[2] += rotn_center[0]
2462-
matrix[5] += rotn_center[1]
2458+
matrix[2] += center[0]
2459+
matrix[5] += center[1]
24632460

24642461
if expand:
24652462
# calculate output size

0 commit comments

Comments
 (0)