You mention in the linked page that the lines did not join. It mat be that your control points are not quite right. Try positioning them with a .5 pixel position so the aliasing overlaps. Do use a +distort option so the resulting image is sized to fit the distorted image. Then 'layer' the two resulting images together using -layers merge, and only then JUNK the virtual canvas offset. This what the control points you define, regardless of if they are positive or negative, will match up and you image will be complete.
Also the line should not be parallel to the bottom of the image! It is perspective after all!
Also the image coordinate should be 1 less than the image size!!!
here are my test commands
Code: Select all
# Generate a Spine Image
convert -size 200x40 xc:lightblue \
-pointsize 20 -gravity north -annotate +5+0 'IM Examples' \
-pointsize 10 -gravity south -annotate +0+0 'ImageMagick' \
-stroke blue -strokewidth 2 -draw 'line 30,0 30,40' \
-rotate -90 /tmp/spine.png
# generate the front cover
convert -size 150x200 xc:lightblue \
-fill black -pointsize 20 -gravity north -annotate +0+5 'IM Examples' \
-fill blue -pointsize 15 -gravity northeast -annotate +5+28 'Box Set' \
-fill black -pointsize 15 -gravity south -annotate +0+5 'ImageMagick' \
-stroke blue -strokewidth 2 -draw 'line 0,170 150,170' \
\( http://imagemagick.org/Usage/images/logo.gif -resize 100x100 \) \
-gravity center -compose multiply -composite /tmp/front.png
# Distort both images and merge together.
convert /tmp/spine.png -virtual-pixel transparent \
+distort Perspective '0,0 -40,20 0,199 -40,179 49,199 0,199 49,0 0,0' \
\( /tmp/front.png \
+distort Perspective '0,0 0,0 0,199 0,199 149,199 99,169 149,0 99,30' \
\) -background black -layers merge +repage box_set.png
rm /tmp/spine.png /tmp/front.png
NOTE that the coordinate order is different and bozzo's coordinates was generated while the -distort command was still in an experimental state.
I am however noticing that the spine image while being transformed correctly, appeared to have been transformed as if it was offset. I have not been able to determine where the mistake lies (the above code, or in the IM code).
the above script will be available in a couple of days at
the above works if I add a -repage +10+0\!
just after reading the spine image. So there is a definite bug in the IM code, where the read in image appears to have the wrong virtual canvas offset (of -10+0 ), even though the image actually does not have this offset. Looking into the fault!