Hi, I have found a bug in Scale Image to New Size... When you downsample image with Nearest Neighbor filter you get wrong result. Pixel values are interpolated, instead of being sampled from the nearest neighbor.
Sample image https://i.imgur.com/koQ0nIh.png
Wrong result https://i.imgur.com/OFdWrhE.png
Git commit 57c3194c1c8aaf9b17fd8f080533610c38a626a7 by Agata Cacko.
Committed on 05/04/2019 at 08:33.
Pushed by tymond into branch 'master'.
Fix results of Nearest Neighbour filter
Before this patch the NN filter would create intermediate colors
in some circumstances, especially when scaling with the scale <50%.
Now the filter will choose one of the colors around instead of
blending colors around to get the result color.
- added tests to test the behaviour of NN filter
- testing on the image: http://www.bealecorner.org/red/test-patterns/star-chart-bars144-600dpi.png
- testing on the image from bug report
Reviewers: dkazakov, #krita
Reviewed By: dkazakov, #krita
Differential Revision: https://phabricator.kde.org/D20246
M +34 -13 libs/image/kis_filter_strategy.cc
M +24 -16 libs/image/kis_filter_strategy.h
M +7 -2 libs/image/kis_filter_weights_applicator.h
M +6 -5 libs/image/kis_filter_weights_buffer.h
M +1 -1 libs/image/kis_transform_worker.cc
M +208 -21 libs/image/tests/kis_filter_weights_applicator_test.cpp
M +10 -0 libs/image/tests/kis_filter_weights_applicator_test.h