djnoz
Mon 15th Dec '03, 1:49pm
I'm trying to overlay a couple of transparent PNG files in GD to create a new PNG file. The images overlay okay, apart from the fact that I'm left with a white background in the resulting image, instead of a transparent background.
<?php
$im = imagecreatefrompng('images/kaldris/kavatar/avatar.png');
$im2 = imagecreatefrompng('images/kaldris/kavatar/jacket.png');
imagecopy($im, $im2, 0, 0, 0, 0, 31, 66);
// Output the image
// ##### Outputs an image into browser
//header ('Content-type: image/png');
//ImagePng ($im);
// ##### Creates image on server
$out = "images/kaldris/kavatar/matrix.png";
ImagePng ($im, $out);
// clean up
ImageDestroy ($im);
ImageDestroy ($im2);
?>
Here is the input and output:
$im
http://www.animesource.co.uk/avatar.png
$im2
http://www.animesource.co.uk/jacket.png
merge result
http://www.animesource.co.uk/matrix.png<-- Look! An annoying white background
Help!
<?php
$im = imagecreatefrompng('images/kaldris/kavatar/avatar.png');
$im2 = imagecreatefrompng('images/kaldris/kavatar/jacket.png');
imagecopy($im, $im2, 0, 0, 0, 0, 31, 66);
// Output the image
// ##### Outputs an image into browser
//header ('Content-type: image/png');
//ImagePng ($im);
// ##### Creates image on server
$out = "images/kaldris/kavatar/matrix.png";
ImagePng ($im, $out);
// clean up
ImageDestroy ($im);
ImageDestroy ($im2);
?>
Here is the input and output:
$im
http://www.animesource.co.uk/avatar.png
$im2
http://www.animesource.co.uk/jacket.png
merge result
http://www.animesource.co.uk/matrix.png<-- Look! An annoying white background
Help!