python-pillow/Pillow — pull request #997 by homm (2014-11-09 02:38:00+00:00)
Title: Replace resize method

Ok, that is why we all there. This PR will became smaller after #977 merging.

Affine-based `im.resize` implementation should be replaced with convolution-based `im.stretch` for Bilinear and Bicubic filters (Lanczos was always there). `im.stretch` uses all pixels from source image for downscale (actually it uses each source pixel in several destination pixels depend of filter), while `im.resize` uses only fixed amount of pixels for each destination pixels (2x2 for bilinear and 4x4 for bicubic).

Examples:
![unsplash2 320 bc r](https://cloud.githubusercontent.com/assets/128982/4966256/11107518-67b8-11e4-9971-d2525cabe965.jpg) ![unsplash2 320 bc](https://cloud.githubusercontent.com/assets/128982/4966255/10d960d2-67b8-11e4-9f62-02db2754a1a5.jpg)

![unsplash1 320 bc r](https://cloud.githubusercontent.com/assets/128982/4966258/21e17fea-67b8-11e4-83af-36b9d61117ab.jpg) ![unsplash1 320 bc](https://cloud.githubusercontent.com/assets/128982/4966257/21df1160-67b8-11e4-880e-6770984678d9.jpg)

This also fixes #986, #964, and possible other related bugs. `im.stretch` also faster for upscaling (especially on Bicubic).

As `im.resize` and `im.stretch` is part of python API (although not documented), we can't just remove one of them. Also `im.stretch` has own Nearest implementation, which is Nearest for upscaling and supersampling for downscaling. Therefore I suggest to leave both functions, replace `im.resize` implementation to convolution-based for all filter except Nearest and use `ImagingTransformAffine` for Nearest.