ID: 40158
Updated by: [EMAIL PROTECTED]
Reported By: henus at mail dot ru
Status: Assigned
Bug Type: GD related
Operating System: Windows XP
PHP Version: 5.2.0
Assigned To: pajoye
New Comment:
>...should be without alpha...
Could you plz elaborate?
A unified diff would explain it much better, btw.
Previous Comments:
------------------------------------------------------------------------
[2007-01-18 14:23:38] henus at mail dot ru
php-5.2.0\ext\gd\libgd\gd.c
Lines 3682-3685:
new_pxl = gdImageColorAllocateAlpha(src, (int)r, (int)g, (int)b, a);
if (new_pxl == -1) {
new_pxl = gdImageColorClosestAlpha(src, (int)r, (int)g, (int)b, a);
}
....should be without alpha...
------------------------------------------------------------------------
[2007-01-18 11:03:15] henus at mail dot ru
My mistake...
correct 12 line in Reproduce code:
imagefilter($mask, IMG_FILTER_COLORIZE, -255, -255, -255);
------------------------------------------------------------------------
[2007-01-18 10:40:42] henus at mail dot ru
Description:
------------
After using imagefilter (IMG_FILTER_COLORIZE) on transparent png image
the result color of translucent pixels is wrong.
I.e. the edge of non-transparent part of image, which contain
translucent antialiasing area - wrong colored.
Reproduce code:
---------------
<?
$mask=imagecreatefrompng("mask.png"); //
http://fort-ross.ru/henus/gd/mask.png (mask for colorize, contain
translucent)
$imagewidth=imagesx($mask);
$imageheight=imagesy($mask);
$imagemain=imagecreatetruecolor($imagewidth,$imageheight);
imagealphablending($mask, TRUE);
imagealphablending($imagemain, TRUE);
$color=imagecolorallocate($imagemain, 0, 0, 0);
imagefill($imagemain, 0, 0, $color);
imagefilter($mask, IMG_FILTER_COLORIZE, -255, -255, 0);
imagecopy($imagemain, $mask, 0, 0, 0, 0, $imagewidth, $imageheight);
imagepng($imagemain,"result_incorrect.png"); //
http://www.fort-ross.ru/henus/gd/result_incorrect.png
imagedestroy($mask);
imagedestroy($imagemain);
?>
Expected result:
----------------
The result image - absolutely black square
Actual result:
--------------
The result image - black square with gray line (on the edge of mask
image)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40158&edit=1