Jason S wrote:As observed in this thread, the documation of convert's -scale option is incorrect or out of date. It says it's equivalent to a box filter, but it evidently uses a pixel averaging algorithm that is only equivalent to a box filter when enlarging or shrinking by an integral factor. I think the documentation should be changed.
(Tested with version 6.8.0-6.)
Nice link about "mixing" vs box filter!
In the following tests (IM 6.8.0.7 Q16), it would appear that when magnifying, Jason S. is correct. However, when minifying, -scale and -filter box -resize, seem to be equivalent. Perhaps I have missed a case.
Jason, can you verify or point me to a case similar to my example that fails to show them equivalent for minifying?
Magnifying 100/4 is an integer
convert -size 2x2 xc:black xc:white +append \( +clone -rotate 180 \) -append \
-scale 100x100 1tmp1.gif
convert -size 2x2 xc:black xc:white +append \( +clone -rotate 180 \) -append \
-filter box -resize 100x100 1tmp2.gif
compare -metric rmse 1tmp1.gif 1tmp2.gif null:
0 (0)
Magnifying 75/4 is not an integer
convert -size 2x2 xc:black xc:white +append \( +clone -rotate 180 \) -append \
-scale 75x75 1tmp3.gif
convert -size 2x2 xc:black xc:white +append \( +clone -rotate 180 \) -append \
-filter box -resize 75x75 1tmp4.gif
compare -metric rmse 1tmp3.gif 1tmp4.gif null:
5333.23 (0.0813798)
Minifying 100/10 is an integer
convert -size 50x50 xc:black xc:white +append \( +clone -rotate 180 \) -append \
-scale 10x10 2tmp1.gif
convert -size 50x50 xc:black xc:white +append \( +clone -rotate 180 \) -append \
-filter box -resize 10x10 2tmp2.gif
compare -metric rmse 2tmp1.gif 2tmp2.gif null:
0 (0)
Minifying 100/15 is not an integer
convert -size 50x50 xc:black xc:white +append \( +clone -rotate 180 \) -append \
-scale 15x15 2tmp3.gif
convert -size 50x50 xc:black xc:white +append \( +clone -rotate 180 \) -append \
-filter box -resize 15x15 2tmp4.gif
compare -metric rmse 2tmp3.gif 2tmp4.gif null:
0 (0)