Edit report at https://bugs.php.net/bug.php?id=65070&edit=1
ID: 65070 Updated by: paj...@php.net Reported by: david at grudl dot com Summary: imagerotate and wrong background color -Status: Feedback +Status: Closed 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: Automatic comment on behalf of pierre....@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=c65d663aefd27e39006b9c20a665893aa5265ed4 Log: fix #65070, bgcolor does not use the same format as the input image with imagerotate Previous Comments: ------------------------------------------------------------------------ [2013-06-20 19:54:34] paj...@php.net 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 :) ------------------------------------------------------------------------ [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] paj...@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