It's nothing to do with shape transformation or -distort
if that is what is confusing you. All that "distortion" means, in this context, is "the specific error metric you requested". When comparing images there are various "metrics" you can select to measure:
and so on. The "distortion" is just a generic term meaning "whichever one of those you selected".
Here is a little example, a 100x10 red rectangle on a large black background.
convert -size 100x10 xc:red -bordercolor black -border 100 a.png

Now roll that 1-pixel to the right and re-save as b.png
:
convert a.png -roll +1+0 b.png

Now compare absolute error:
compare -metric ae [ab].png null:
20
and you can see that the 10 pixels on the left and 10 pixels on the right of the red bar are "distorted".
Now roll down one pixel instead of across and compare again:
convert a.png -roll +0+1 b.png
compare -metric ae [ab].png null:
200
and the "distortion" is 100 pixels along the top pf the red bar that have become black and 100 pixels below the bottom of the red bar that have become red.
It may make more sense if you use the convert
based method of comparing rather than the compare
method. Here, you use the more common convert
command with 2 images and then use -compare
as the operator but you now will see the variable called distortion being used and that it just refers to whatever -metric
you selected:
convert a.png b.png -metric AE -compare -format "%[distortion]" info:
200