How to initialize the end size of image after affine transformation. How can i calculate them?
from PIL import Image
import math
img = Image.open('image.png')
img.convert('RGB')
result = Image.new('RGB', (87, 87)) # and here I want to know the dimensions in advance, because now I have entered them myself
width, height = img.size
a = 60 * (math.pi / 180)
xmin = width
xmax = 0
ymin = height
ymax = 0
for i in range(0, width):
for j in range(0, height):
colors = img.getpixel((i, j))
x = int(i * math.cos(a) + j * math.sin(a))
y = -int(i * math.sin(a) - j * math.cos(a) - 54)
result.putpixel((x, y), colors)
result.show()
```
In short, we get only corner pixels transformed coordinates.