How can I apply ImageMagick’s unified distortion map via Python/Wand?
IM documentation: https://www.imagemagick.org/Usage/mapping/#distortion_maps
How it works in a shell script (IM 6.9):
convert "$content" \
-resize 1700x1700\! \
-matte "$map" \
-compose Distort -composite "$distorted"
Or:
convert "$content" -resize 1700x1700\! -alpha set "$map" \
-compose Distort -composite \
"$distorted"
The resize brings the input image to the size of the map, as otherwise the result gets clipped.
I experimented with defining an image as content and using content.compose() or content.composite(), but any attempt at filling in arguments results in complaints.
I figured it out after seeing an example with
operatorand noticing there’salpha_channel. The solution is:Thanks to everyone who took a look.