Bug #72913 [Asn->Csd]: imagecopy() loses single-color transparency on palette images
| From: | cmb@php.net | Date: | Sun, 21 Aug 2016 15:57:15 +0000 |
| Subject: | Bug #72913 [Asn->Csd]: imagecopy() loses single-color transparency on palette images | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-203455@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72913&edit=1
ID: 72913
Updated by: cmb@php.net
Reported by: cmb@php.net
Summary: imagecopy() loses single-color transparency on
palette images
-Status: Assigned
+Status: Closed
Type: Bug
Package: GD related
Operating System: *
PHP Version: 7.0.10
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d65adac2be2c9b32d9ad9bd00399c99d492502f5
Log: Fix #72913: imagecopy() loses single-color transparency on palette images
Previous Comments:
------------------------------------------------------------------------
[2016-08-21 15:26:28] cmb@php.net
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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72913&edit=1