Remove transparent space from a png image while merging with another png image using PHP GD -
i merging 2 png images in php code using php-gd. images getting merged, problem there transparent space in image want remove.
here php code.
<?php $image1url = "/home/sunpure-refined-sunflower-oil-v-5-ltr-1.png"; $image2url = "/home/hypercity-every-day-sooji-rawa-v-1-kg-6.png"; $dest = imagecreatefrompng($image1url); $src = imagecreatefrompng($image2url); $offset2x = imagesx($src); $offset3x = imagesx($dest); $temp = imagecreatetruecolor($offset2x + $offset3x, 140); $background = imagecolorallocate($temp, 0, 0, 0); imagecolortransparent($temp, $background); imagecopymerge($temp, $src, 0, 0, 0, 0, 180, 180, 100); //have play these numbers work you, etc. imagecopymerge($temp, $dest, $offset2x-50, 0, 0, 0, 180, 180, 100); header('content-type: image/png'); imagepng($temp, "/home/myimage.png"); imagedestroy($dest); imagedestroy($src);
in rightmost image, trying remove space between them , due transparent space, not happening.
Comments
Post a Comment