Answer the question
In order to leave comments, you need to log in
How does PIL.Image.PERSPECTIVE work?
Good afternoon.
I started to study Pillow and the following question arose:
How does PIL.Image.PERSPECTIVE mode work in img.transform?
img = Image.new("RGB", (100, 100), (155, 155, 155))
draw = ImageDraw.Draw(img)
draw.text((0, 90), "LOLOLOLOLOLOLOL!", font=font)
draw.text((0, 80), "LOLOLOLOLOLOLOL!", font=font)
draw.text((0, 70), "LOLOLOLOLOLOLOL!", font=font)
draw.text((0, 60), "LOLOLOLOLOLOLOL!", font=font)
draw.text((0, 50), "LOLOLOLOLOLOLOL!", font=font)
img.transform((100, 100), Image.PERSPECTIVE, (25, 25, 25, 75, 75, 75, 75, 25))
Answer the question
In order to leave comments, you need to log in
No, the coordinates are not indicated there, but the coefficients of the equation (ax + by + c) / (gx + hy + 1), (dx + ey + f) / (gx + hy + 1), calculates the coordinates, where to get the value for each pixel (x, y).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question