Downloading the low res versions from image shack is not recommended. It is a horrible image cloud service.
I downloaded the full images and checked the mask against the background canvas...
(just a disolve of the mask overlayed on the canvas...
convert canvaslbw.png canvasmask.png -define compose:args=50% -compose dissolve -composite show:
Looks like a good fit.
WARNING: when using +distort, you generate a layer image with image offsets! That is your problem!
Remember +distort is bestfit, with image offsets. Lower level composition does not use image offsets, only user input geometry offsets are used, not layer offsets with is a higher level operation.
This makes masking the distorted image trickier! Especially as -layers merge is not designed with masking in mind!
Easiest solution is set your own 'viewport' (output image size) for the distort to the size needed for the "canvasmask.png" (zero offset). That removes the offset problem, though does make teh distort a little longer while it processes the extra pixels.
With everything aligned you then can use lower level composition to handle the masking.
And then add canvas and highlights as you need. (High lighting does not currently preserve transparency!)
So an extra masking step is also added (this could use some improvement)
Code: Select all
identify canvasmask.png
canvasmask.png PNG 1000x917 1000x917+0+0 8-bit DirectClass 13.3KB 0.000u 0:00.000
convert preview2d.png -alpha set -virtual-pixel transparent \
-define distort:viewport=1000x917+0+0 -distort perspective \
"0,0,50,130 974,0,985,36 0,734,50,903 974,734,981,719" \
\( canvasmask.png -alpha shape \) -compose DstIn -composite \
canvaslbw.png +swap -compose over -composite \
canvashighlights.png -compose hardlight -composite \
canvaslbw.png -compose DstIn -composite \
result.png
NOTE: a check of the distorted image shows a white line at the bottom, that comes from the original "preview2.png" input image. Adjustment of the source distort coordinates (which is image coordinates NOT pixel coordinates) may be needed in order to remove that line! See
http://www.imagemagick.org/Usage/distor ... oordinates