You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I resized an image of size 5x19 down to 5x10 with resample=Image.BOX.
The input, upscaled 10x for clarity
What did you expect to happen?
I expected each input pixel to correspond to one output pixel, as per documentation.
What actually happened?
The middle row didn't contribute to the output at all - it was totally left out (see result).
What are your OS, Python and Pillow versions?
OS: Ubuntu 22.04, Linux 6.8.0-138-generic
Python: 3.10.12
Pillow: 9.0.1 and 12.3.0 (tested on both, same result)
--------------------------------------------------------------------
Pillow 12.3.0
Python 3.10.12 (main, Jul 15 2026, 23:40:17) [GCC 11.4.0]
--------------------------------------------------------------------
Python executable is /usr/bin/python3
System Python files loaded from /usr
--------------------------------------------------------------------
Python Pillow modules loaded from /home/michalz/.local/lib/python3.10/site-packages/PIL
Binary Pillow modules loaded from /home/michalz/.local/lib/python3.10/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 12.3.0
*** TKINTER support not installed
--- FREETYPE2 support ok, loaded 2.11.1
*** LITTLECMS2 support not installed
*** WEBP support not installed
*** AVIF support not installed
--- JPEG support ok, compiled for libjpeg-turbo 2.0.6
*** OPENJPEG (JPEG2000) support not installed
--- ZLIB (PNG/ZIP) support ok, loaded 1.3.1.1-motley
--- LIBTIFF support ok, loaded 4.6.0
*** RAQM (Bidirectional Text) support not installed
*** LIBIMAGEQUANT (Quantization method) support not installed
*** XCB (X protocol) support not installed
--------------------------------------------------------------------
Repro:
importPIL.Imageimportnumpyasnpdefcheckerboard(w, h):
a= (np.arange(w).reshape((1, w, 1)) ^np.arange(h).reshape((h, 1, 1))) &1returna.astype(np.uint8) *np.uint8([255, 255, 255])
c=checkerboard(5, 19)
c[:9,:,1:3] =0# make top part red...c[9,:,::2] =0# ...middle row green...c[10:,:,0:2] =0# ...and bottom part blueinput=PIL.Image.fromarray(c)
resized=input.resize((5, 10), resample=PIL.Image.BOX)
Thanks, @radarhere!
This indeed seems like a duplicate. I'm currently working on an accelerated Pillow fork and hit this issue in testing.
I currently get this output - is it the same as the one from the proposed PR? If we're about to make an arbitrary decision on where the pixels contribute, I'd like to be in sync with future Pillow versions.
The visual difference is visible at the image center horizontal line:
(I downscaled your gray-scaled image from 5x19 to 5x10 (by 1.9 times by height), then the result upscaled by 25 times. PIL's result is the second one.)
The interested moment here is that, when I downscale your 26x100 pixel version image by 1.9 from 50x190 to 26x100, the difference is not at the center line, but bottom:
(The result is upscaled by 5 times.)
So, it confirms, what the problem appears not only on the center lines (vert/horz).
Activity
radarhere commentedon Sep 4, 2026
Hi. This seems like a duplicate of #9939
#9949 is a suggested fix. In your case, it would generate (fuzziness is because I've increased the width and height in HTML)

mzient commentedon Sep 4, 2026
Thanks, @radarhere!

This indeed seems like a duplicate. I'm currently working on an accelerated Pillow fork and hit this issue in testing.
I currently get this output - is it the same as the one from the proposed PR? If we're about to make an arbitrary decision on where the pixels contribute, I'd like to be in sync with future Pillow versions.
radarhere commentedon Sep 4, 2026
Yes, the image you just posted is the same as the one I posted from the proposed PR.
AlttiRi commentedon Sep 4, 2026
Yes, it's the same problem.
The visual difference is visible at the image center horizontal line:

(I downscaled your gray-scaled image from 5x19 to 5x10 (by
1.9times by height), then the result upscaled by25times. PIL's result is the second one.)The interested moment here is that, when I downscale your 26x100 pixel version image by
1.9from50x190to26x100, the difference is not at the center line, but bottom:(The result is upscaled by
5times.)So, it confirms, what the problem appears not only on the center lines (vert/horz).