Answer the question
In order to leave comments, you need to log in
How to merge two photos?
To create a panoramic photo, you need two 180 degree lenses.
I'm trying to develop a script, but it doesn't work.
Please help.
The script should connect the photo horizontally to another.
Roughly what I came up with:
<?php
$dest = imagecreatefromjpeg('360/merge/img/IMG_0663.JPG');
$src = imagecreatefromjpeg('360/merge/img/unnamed (1).jpg');
imagealphablending($dest, false);
imagesavealpha($dest, true);
imagecopymerge($dest, $src, 10, 9, 0, 0, 181, 180, 100);
header('Content-Type: image/png');
imagepng($dest);
imagedestroy($dest);
imagedestroy($src);
?>
Answer the question
In order to leave comments, you need to log in
For images of the same height: create an image with a width equal to the sum of the sizes by the width of the original photos and only after that copy the first photo there at coordinates (0; 0), and the second at coordinates (width 1 image; 0).
Variations are possible for images of different heights:
1 - the resulting image in height will be equal to the largest image in height, then it is better to center the second (smaller in height) image in height;
2 - the resulting image in height will be equal to the smallest image in height, then the second (larger in height) image should be cropped (centered out of bounds) in height.
PS: You can create the resulting image using the imagecreatetruecolor function
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question