Bug #75124 [Ana->Csd]: gdImageGrayScale() may produce colors
Edit report at https://bugs.php.net/bug.php?id=75124&edit=1
ID: 75124
Updated by: cmb@php.net
Reported by: cmb@php.net
Summary: gdImageGrayScale() may produce colors
-Status: Analyzed
+Status: Closed
Type: Bug
Package: GD related
Operating System: *
PHP Version: 7.0.22
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=499f5480f1a9b3063097b53592c37329c1d5f6f8
Log: Fixed bug #75124 (gdImageGrayScale() may produce colors)
Previous Comments:
------------------------------------------------------------------------
[2017-08-27 11:32:57] cmb@php.net
Description:
------------
For ease of reference, I'm forwarding libgd bug #386[1].
TL;DR: gdImageGrayScale() misses to switch to gdEffectReplace
alpha blending mode before calling gdImageSetPixel which may
result in colored images.
[1] <https://github.com/libgd/libgd/issues/386>
Test script:
---------------
<?php
$im = imagecreatefrompng(__DIR__ . '/wings.png');
imagefilter($im, IMG_FILTER_GRAYSCALE);
imagepng($im, __DIR__ . '/wings-out.png');
Expected result:
----------------
The generated wings-out.png should be a pure grayscale image.
Actual result:
--------------
The generated wings-out.png shows faintly purple colors.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75124&edit=1
Thread (3 messages)