Bug #65070 [Fbk]: imagerotate and wrong background color
| From: | pajoye@php.net | Date: | Thu, 20 Jun 2013 19:54:34 +0000 |
| Subject: | Bug #65070 [Fbk]: imagerotate and wrong background color | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-179657@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65070&edit=1
ID: 65070
Updated by: pajoye@php.net
Reported by: david at grudl dot com
Summary: imagerotate and wrong background color
Status: Feedback
Type: Bug
Package: GD related
Operating System: Windows
PHP Version: 5.5.0
Assigned To: pajoye
Block user comment: N
Private report: N
New Comment:
There are two problems in the current code, which could be a BC break tho'
1. The source image has not transparent color set
2. imagerotate expects a truecolor color (ARGB)
I think 2. is a BC break and should consider the input format as matching the
source image color format. Fix on its way :)
Previous Comments:
------------------------------------------------------------------------
[2013-06-20 16:32:43] david at grudl dot com
Example code:
$im = imagecreatefromgif('logo-white.gif'); // http://files.nette.org/icons/logo-white.gif
$res = imagerotate($im, 30, imagecolorallocatealpha($im, 0, 0, 0, 0)); // black
imagepng($res, 'result.png'); // background is blue
PHP 5.5.0 (Thu, 20 Jun 2013 00:29:47)
Build: C:\php-sdk\php55\vc11\x86\obj\Release_TS
------------------------------------------------------------------------
[2013-06-20 16:18:40] pajoye@php.net
It copies pixel by pixel using the colors defined by the color index.
I will check it again but 1st test did not reproduce this problem.
If you have a self contained script to show how this problem occurs in your app,
please post it here.
------------------------------------------------------------------------
[2013-06-20 15:41:23] david at grudl dot com
Description:
------------
When is non-truecolor image rotated, it is converted to truecolor. Problem is with background color.
In PHP < 5.5 is used correct color, exactly as choosed using imagecolorallocatealpha(), but in
PHP 5.5 is used wrong color, probably closest color in palette.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65070&edit=1