to keep it simple I am trying to put a image on a image/canvas. Canvas = 1920x1080, image size doesn't matter. I want to add the image into the canvas but with specific x/y coordination for each corner. Look at my array here below to see what I'm working with:
[0] => Array
(
[cp1x] => 500
[cp1y] => 250
[cp2x] => 250
[cp2y] => 380
[cp3x] => 400
[cp3y] => 700
[cp4x] => 1500
[cp4y] => 800
)
CP1X/CP1Y are for the top left. CP2X/CP2Y are for the top right. CP3X/CP3Y are for the lower left. CP4X/CP4Y are for the lower right.
I'd preferably get a solution in php and -or ImageMagick.
Also made sketches to give a better explanation. Hope it's all clear.
Tried making it with Imagick and PHP transform.


I don't have any working PHP setup, but here's how you do it on the command line. I used a 1920x1080 swirl as the background (
bg.jpg) with your 400x400 overlay image as the foreground (fg.jpg) to distort:You will see there are 4 pairs of coordinates, with those in the source image listed before the corresponding point in the destination image.