For the reasons why Distort in a non-rotation 'NO-OP' (which is what you did) produces a change see..
IM Examples, Distort, No-Op Distortions
http://www.imagemagick.org/Usage/distorts/#distort_noop
Now
-rotate actually uses distort to do the rotations! But it also will short-circuit on a NO-OP (or use
Simple Image Warps for 90 degree rotation cases) so as to preserve the image exactly.
At one point rotate did its rotations based on the use of shears (using a 3 step operation developed by Alan Paeth)
But using 3 shearing steps (making it slow) and the limitations of shear (no sub-pixel alignment) produced inconsistent rotations. The rotate-shear algorithm is still present in the ImageMagick API library, but is no longer available from command line.
Hmmm... "convert" lists
-rotate incorrectly!
convert
...
-rotate degrees apply Paeth rotation to the image
...
My recommendation is to turn off EWA cylindrical/elliptical filtering for the distort color lookups, (
-filter point) and then set an interpolation that you are happy with for the scaling.
See IM Examples, Miscellaneous, Interpolate
http://www.imagemagick.org/Usage/misc/#interpolate
NOTE: for rotations I would normally recommend
-interpolate mesh which was designed specifically for rotations of images with sharp boundaries. Unfortunately for a 'pixel hash' that you are using as a test, it will interpret it as a set of diagonal lines, rather than a grid of 'dots'. So I selected '
Catrom' to produce a sharper result, instead of the more normal '
Bilinear' interpolation.
I also recommend you do the scaling as part of the SRT rotation! It saves time, and magnifies just well as most resize operators.
Code: Select all
magick -size 50x50 pattern:gray50 \
-virtual-pixel white -filter point -interpolate catrom \
+distort SRT "4 0" +repage rotate_mesh_0.png
magick -size 50x50 pattern:gray50 \
-virtual-pixel white -filter point -interpolate catrom \
+distort SRT "4 17" +repage rotate_mesh_17.png
A
17 degree angle is about the worst possible angle for rotation. All interpolations except
Spline will generally produce a perfect NO-OP for 90 degree rotations, The blurring effects in the result is the scaling aspect.
For a 'box' like filter use
-interpolate nearest.