Replace resize method#997
Replace resize method#997wiredfool merged 11 commits intopython-pillow:masterfrom homm:replace-resize
Conversation
|
Oh, I don't even run the tests. Let's discuss first. |
|
I recommend enabling Travis (and perhaps Coveralls) on your own repo. See also https://github.com/python-pillow/Pillow/blob/master/CONTRIBUTING.md |
|
@wiredfool Any thoughts? |
|
I'm thinking about the interfaces. We have very similar Nothing in Pillow calls I think that the lower level calls in Other than that, it looks good to me. |
|
Distinction in |
type switch default case was never achieved because special images is in image8 pointers, not in image32
mark im.stretch as deprecated.
|
@wiredfool I've fixed test a bit and make What you think about renaming |
|
Resample sounds like a good rename. Will look over the code after dinner. |
|
Ok, Good to 41029f0. |
|
renamed |
|
Looks good to me to bc0f896. Anything else to do? |
|
@wiredfool No, I suppose. |
Ok, that is why we all there.
Affine-based
im.resizeimplementation should be replaced with convolution-basedim.stretchfor Bilinear and Bicubic filters (Lanczos was always there).im.stretchuses all pixels from source image for downscale (actually it uses each source pixel in several destination pixels depend of filter), whileim.resizeuses only fixed amount of pixels for each destination pixels (2x2 for bilinear and 4x4 for bicubic).Examples:

This also fixes #986, #964, and possible other related bugs.
im.stretchalso faster for upscaling (especially on Bicubic).As
im.resizeandim.stretchis part of python API (although not documented), we can't just remove one of them. Alsoim.stretchhas own Nearest implementation, which is Nearest for upscaling and supersampling for downscaling. Therefore I suggest to leave both functions, replaceim.resizeimplementation to convolution-based for all filter except Nearest and useImagingTransformAffinefor Nearest.