fmw42 wrote:If you post your two input images, I can process it and show you the command line. What version of Imagemagick are you using and what platform. Syntax for distort control points changed quite a while ago. So if you are using an ancient version of Imagemagick, then the control point syntax may be different. You post to some place such as dropbox.com and put the URLs here
Please always provide your IM version and platform, since syntax may differ.
Thanks for reply. I am using the latest IM version 7.0.2-5-Q16-x64 for windows. I tried what you suggested, it seemed simple, but it doesn't work for some case.
1. here is download link for background
https://yadi.sk/i/kaCIs2V1taeAF
2. here is download link for foreground
https://yadi.sk/i/urYccDzFtaeAD
I made everything as you wrote, here is my command:
Code: Select all
magick convert background.png ^( foreground.jpg +distort perspective "0,0 874,240 322,0 1286,338 0,572 732,948 322,572 1150,1026" )^ -layers merge +repage resultimage.png
Code: Select all
0,0 is the top left corner of the foreground image
874,240 is the top left corner of the red box area
322,0 is the top right corner of the foreground image
1286,338 is the top right corner of the red box area
0,572 is the bottom left corner of foreground image
732,948 is the bottom left corner of the red box area
322,572 is the bottom right corner of the foreground image
1150,1026 is the bottom right corner of the red box area
Note: The coordinates of the red box area are a bit inaccurate, I quickly grabbed them in gimp for testing purposes.(but I guess this doesn't matter because the result is much more different then coornitates inaccuracy.
The problem: Result image. See below
