Bug #72913 [NEW]: imagecopy() loses single-color transparency on palette images
| From: | cmb@php.net | Date: | Sun, 21 Aug 2016 15:26:30 +0000 |
| Subject: | Bug #72913 [NEW]: imagecopy() loses single-color transparency on palette images | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-203453@lists.php.net to get a copy of this message | ||
From: cmb
Operating system: *
PHP version: 7.0.10
Package: GD related
Bug Type: Bug
Bug description:imagecopy() loses single-color transparency on palette images
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 bug report at https://bugs.php.net/bug.php?id=72913&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72913&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72913&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72913&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72913&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72913&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72913&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72913&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72913&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72913&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72913&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72913&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72913&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72913&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72913&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72913&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72913&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72913&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72913&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72913&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72913&r=mysqlcfg