Add the box scaling method
Environment/Versions
- GIMP version: 2.10.30
- Package: Windows installer
- Operating System: Windows 10
Description of the bug
When attempting to scale an image to a lower resolution with no interpolation, it appears a very simple (bad) algorithm is used. Many pixels in the source image are ignored rather than averaged into the result.
Reproduction
Is the bug reproducible? Always
Reproduction steps:
- Create a 15x15 pixel image which looks like a 3x3 checkerboard with black corners (and black center), where each of the checkerboard squares is 5x5 pixels.
- Using the pencil tool, paint only the very center pixel white.
- Scale the image down to 3x3 pixels, with no interpolation.
The center pixel in the 3x3 image ends up WHITE, rather than NEARLY BLACK.
…
Expected result: The center pixel of the 3x3 image should be very close to black, being an average of the color of the 25 pixels making up the center checkerboard square (of which there is only one white pixel).
Actual result: The center pixel of the 3x3 image is WHITE.
Additional information
In the attached image, I use colors red and green in the center square, but the principle is the same.
If you have a backtrace for a crash or a warning, paste it here.