ImageMagick does not come with the functionality you want builtin, but thanks to the -fx
argument you can write your own.
The following command will rotate the source image clockwise by the applied mask:
convert input.png rotationmap.png -fx \
'rs=-6.28318531;
p{
cos(v*rs)*(i-w/2.0)-sin(v*rs)*(j-h/2.0)+w/2.0,
sin(v*rs)*(i-w/2.0)+cos(v*rs)*(j-h/2.0)+h/2.0
}' output.png
Fill the rotation map with #202020
to rotate by 45 degrees for example:
hexval = (rotation_deg / 360) * 255
Or do sillier stuff (this is fun to play with, actually):
Caveats:
- Cut off corners just repeat indefinitely.
- Rotation map needs to be the same size as the source image.
- No resampling, result might get blurry or edgy.