How to combine PNGS with alpha channels into one enlarged image?

I am trying to add these:

gametile_masked_filegamertile_masked_filesanctum-background.png

in it:

alt text

But I keep getting this:

alt text

This is the appropriate code, I'm not sure what I am missing:

    $sig_background = imagecreatefrompng("sanctum-signature.png");
imagealphablending($sig_background, false);
imagesavealpha($sig_background, true);
$sig_gamertile = imagecreatefrompng($gamertile_masked_file);
imagealphablending($sig_gamertile, false);
imagesavealpha($sig_gamertile, true);
$sig_gametile = imagecreatefrompng($gametile_masked_file);
imagealphablending($sig_gamertile, false);
imagesavealpha($sig_gamertile, true);
imagecopymerge($sig_background, $sig_gamertile, 175, 2, 0, 0, 64, 64, 100);
imagecopymerge($sig_background, $sig_gametile, 342, 20, 0, 0, 64, 64, 100);

If any information is missing, let me know and I will try to fill in the blanks. Thank you for your time.

edit - here are links to files (hosted on photobucket) gamertile gametile

+3
source share
2 answers

Is there a typo in the code, is it a copy / paste error or a real error?

You do:

$sig_gamertile = imagecreatefrompng($gamertile_masked_file);
imagealphablending($sig_gamertile, false);
imagesavealpha($sig_gamertile, true);

And then:

$sig_gametile = imagecreatefrompng($gametile_masked_file);

But right after that, you continue to call functions on $sig_gamertileinstead of $sig_gametile:

imagealphablending($sig_gamertile, false);
imagesavealpha($sig_gamertile, true);

, .

0

:

imagealphablending($im, false);

-. true false.

0

Source: https://habr.com/ru/post/1780796/


All Articles