Imagemagick skew image with 4 (x,y) coordinates

一个人想着一个人 提交于 2019-12-21 23:09:14

问题


I have 4 (x,y) coordinates between which I want place image as example given below.

The whole image must be placed within this area without cropping.


回答1:


Using this 800x600 balloon:

You can use a "Perspective Distort" like this:

convert balloon.jpg -matte -virtual-pixel transparent  \
  -distort Perspective '0,0,50,0 0,599,100,599 800,0,750,100 800,600,500,500' result.png

There are basically 4 pairs of points in the parameters,i.e.

Pt1X,Pt1Y,Pt1NewX,Pt1NewY Pt2X,Pt2Y,Pt2NewX,Pt2NewY Pt3X,Pt3Y,Pt3NewX,Pt3NewY Pt4X,Pt4Y,Pt4NewX,Pt4NewY

So the command above moves point 0,0 to 50,0 and moves point 0,599 to 100,599 and so on.

I have labelled each of the points in red and drawn the path along which each one has moved in green.



来源:https://stackoverflow.com/questions/50149907/imagemagick-skew-image-with-4-x-y-coordinates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!