Join Multiple transparent png image in Single image into php -


friends want generate 1 png image multiple transparent png image issue can generate last image

both images can not combine.

my code given below

$x = 363; $y = 267;  $im_dest = imagecreatetruecolor ($x, $y); imagealphablending($im_dest, false);  $im = imagecreatefrompng('2.png'); $im1 = imagecreatefrompng('1.png');  imagecopy($im_dest, $im1, 0, 0, 0, 0, $x, $y); imagecopy($im_dest, $im, 0, 0, 0, 0, $x, $y);  imagesavealpha($im_dest, true); imagepng($im_dest, 'small_redfade.png'); 

these images using join in single image

http://s11.postimg.org/h6lui7yjn/image.png

http://s21.postimg.org/o7zdnwcnb/image.png

imagemagick::composite can handle this, sadly haven't done in gd leave others explain how there.

something like:

<?php  $firstimage = new imagick("firstimage.png"); $secondimage = new imagick("secondimage.png");  $firstimage->compositeimage($secondimage, imagick::composite_copyopacity, 0, 0 );  header('content-type: image/png'); echo $firstimage;  ?> 

this should preserve alpha.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -