[Image-SIG] Image warping in Python or PIL

Oliver Tonnhofer olt at bogosoft.com
Sat May 8 14:38:17 CEST 2010

On 08.05.2010, at 13:49, Fredrik Lundh wrote:
> The transform(MESH) operation might be what you need.
>    http://effbot.org/tag/PIL.Image.Image.transform
> Instead of mapping between individual pixels, cover the output image
> with a grid, and calculate the source pixels for the corners of each
> grid rectangle (forming a quadrilateral area).  Pass in the resulting
> list of (grid rectangle, quadrilateral) pairs to transform(MESH), and
> it'll take care of the rest.

That's what I used to transform maps/aerial images from one coordinate system to another. 

> The result is (usually) an approximation, with the maximum error
> controlled by the grid resolution.

I did tests with 1500x1500px and there where no improvements beyond 8x8. The performance is really great. Even faster than GDAL which is a C library for exactly this kind of image processing.


More information about the Image-SIG mailing list