Code: Select all
w := width of test.jpg
h := height of test.jpg
convert test.jpg -distort -virtual-pixel black -distort Perspective "0,0,x1,y1 w,0,x2,y2 w,h,x3,y3 0,h,x4,y4" output.jpg
Code: Select all
w := width of test.jpg
h := height of test.jpg
convert test.jpg -distort -virtual-pixel black -distort Perspective "0,0,x1,y1 w,0,x2,y2 w,h,x3,y3 0,h,x4,y4" output.jpg
A 4 point trapezoid distortion is a Bilinar Distortion. This preserves distances, and orthogonal lines in the image.qwertz wrote:In that old toolkit there is a function named MapTexture() which distorts the input image to a trapezoid that is defined by 4 points that must be given: (x1|y1),(x2|y2),(x3|y3),(x4|y4).
Affine does give shear! What it doesn't give is position dependant scaling (image gets smaller on one side compares to the other.)snibgo wrote:The obvious method is "-distort perspective". The "-distort affine" "-affine" options don't give you shear, which you need.