|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-08-21 15:26 UTC] cmb@php.net
-Assigned To:
+Assigned To: cmb
[2016-08-21 15:57 UTC] cmb@php.net
[2016-08-21 15:57 UTC] cmb@php.net
-Status: Assigned
+Status: Closed
[2016-10-17 10:09 UTC] bwoebi@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 21:00:01 2025 UTC |
Description: ------------ When copying a single-color transparency true-color image onto a palette image with imagecopy(), the transparency is lost, if compiled against the bundled libgd. With external libgd it works fine. That bug affects all currently supported PHP versions. Test script: --------------- <?php $base64 = 'iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAABnRSTlMAAAAAAABu' . 'pgeRAAAAVklEQVRYw+3UQQqAMBAEwf3/p9eTBxEPiWAmWMU8oGFJqgAAuOpzWTX3' . 'xQUti+uRJTZ9V5aY1bOTFZLV7yZr9zt6ibv/qPXfrMpsGipbIy7oqQ8AYJED1plD' . 'y5PCu2sAAAAASUVORK5CYII='; $src = imagecreatefromstring(base64_decode($base64)); $dst = imagecreate(50, 50); $transparent = imagecolorallocatealpha($dst, 255, 255, 255, 127); imagealphablending($dst, false); imagesavealpha($dst, true); imagecopy($dst, $src, 0,0, 0,0, 50,50); imagepng($dst, __DIR__ . '/test.png'); Expected result: ---------------- An image with red circle on a _transparent_ background. Actual result: -------------- An image with red circle on a _black_ background.