|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-01-15 23:31 UTC] michel at breggen dot nl
Description:
------------
when creating a new truecolor image, the image gets set with a black background. This makes it unusable to blend alpha transparant png's onto it (for creating transparant thumbnails for example). Normally you would have a blank (all transparant) image when creating a new image because no data has been added to it.
Reproduce code:
---------------
$img = imagecreatetruecolor(50,50);
header ("Content-type: image/x-png");
imagepng($img);
imagedestroy($img);
Expected result:
----------------
a transparant 50x50 png image.
Actual result:
--------------
a black 50x50 png image
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 06:00:01 2025 UTC |
Hi, Not sure this is a bug. if you do : $im = imagecreatetruecolor(50,50); header ("Content-type: image/x-png"); imagesavealpha($im, true); $bg=imagecolorallocatealpha ($im, 0,0,0,127); imagefill($im,0,0,$bg); imagepng($im); imagedestroy($im); the result is what you want.