This is a pretty tricky task: ImageMagick has built-in distortion effects, but nobody looks like the one you need.
To achieve your goal, you can try to determine user distortion: for example, using image cards (in particular, cards with distortions with distortion distortions, more information here ).
Basically, you create a black and white gradient image (map) that defines how a particular effect should be applied to each pixel in the image.
The hard part generates the image map correctly: you can do it manually or using ImageMagick.
For example, this command, taken from ImageMagick documents, creates a map of spherical distortions:
convert -size 100x100 xc: -channel R \ -fx 'yy=(j+.5)/h-.5; (i/w-.5)/(sqrt(1-4*yy^2))+.5' \ -separate +channel sphere_lut.png
this is the resulting image:

once you have created a distortion map, you can apply it to your image, for example:
convert input.png lut_mask.png -fx 'p{ v*w, j }' output.png
source share