Some small things, that will make thing easier....
I don't know why you only see horizontal or vertial displacements. Perhaps your IM is too old, as there are BUGS,
in older versions that limit effects to three image compositions.
Make sure your IM version is greater than version 6.4.4 as that was the version when I 'fixed' displacement mapping.
Better still use version 6.5.4-0, whcih was when I actually LAST did major work on 'mapping' composition methods.
Next your composition is using a greyscale 'source' or 'displacement map' image with a argument of 5x5. As only one greyscale value is provided for BOTH X and Y displacement, the displacement is limited to the diagonal direction, +/-5 pixels in X and +/-5 in Y according to that value (50% grey = 0 displacement).
For non-diagonal (any direction) you need two independent displacement maps, one for X and the other for Y either as a three image composition, or as a single map which uses red for X, and green for Y displacement. The second method is very easy to apply, as you just don't seperate the channels from the random blurred image. All the noise and blur operators are greyscale channel operators, so they effect the red and green channels completely separately.
Also you can use the original image (a clone) to generate a random image (and final map) that is exactly the same size, without needing to know about that size. You don't need to use
-size XxY xc: unless starting from scratch
To make to make the displacements clear (without using a '
flicker compare' type program) I used a checkerboard pattern for the original (destination) image. Your supplied test image is too random to see displacement effects very clearly.
I also used convert
-composite to do the task, as I find it easier to do things in one command. Fred's script uses composite command, as he wanted his scripts to work on IM's that are older that when the special "compose:arg" definition was added. In IM v6.5.3-4
And finally I used a Virtual pixel setting of Gray (displacement zero) to minimize (by 50%, but not remove) the displacement at the edges (or you can get weird edge effects) during the random image blurring. To get ride of edge displacements, (or make the displacements more circular), a little more will will be needed on the displacement map.
I also used a virtual-pixel black setting for the actual displacement, to show the 'invalid' lookup edge effects that is generated.
Code: Select all
convert -size 200x200 pattern:checkerboard png24:cb.png
convert cb.png \
\( +clone +noise Random -virtual-pixel Gray -blur 0x8 \) \
-virtual-pixel Black -define compose:arg=5x5 -compose displace -composite \
cb_displaced.png
You can see from comparing the intersections the displacement was in any direction (in a 5x5 max box)
Remember the other method would be limited to a diagonal displacement (5x5 max)
For more info see IM Examples, Displacment Mapping
http://www.imagemagick.org/Usage/mappin ... ement_maps
This area of IM examples needs a lot more work and examples, (and to move away from all the FX examples used) to demonstrate IM's image mapping capabilities.