Scaling with Python Image Library

I am writing a simple Python application that displays images. I need to implement Zoom In and Zoom Out by scaling an image.
I think the Image.transform method will be able to do this, but I'm not sure how to use it, since it requests an affine matrix or something like that: P
Here is a quote from the docs:

im.transform (size, AFFINE, data, filter) => image

Applies the affine transform to the image and puts the result in a new image with the given size.

The data is a 6-tuple (a, b, c, d, e, f) that contain the first two rows from the affine transformation matrix. For each pixel (x, y) in the output image, the new value is taken from the position (ax + by + c, dx + ey + f) in the input image, rounded to the nearest pixel.

This function can be used to scale, translate, rotate, and shift the original image.

+5
source share
2 answers

EXTENT, AFFINE. : . , , (.. 2), (0, 0, im.size [0], im.size [1]) (im.size [0]/2, im.size [1]/2).

+5

, . . SO:

0

All Articles