|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75124 gdImageGrayScale() may produce colors
Submitted: 2017-08-27 11:32 UTC Modified: 2017-08-27 11:37 UTC
From: Assigned: cmb (profile)
Status: Closed Package: GD related
PHP Version: 7.0.22 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2017-08-27 11:32 UTC]
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] <>

Test script:

$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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-08-27 11:37 UTC]
-Status: Open +Status: Analyzed -Assigned To: +Assigned To: cmb
 [2017-08-27 12:20 UTC]
Automatic comment on behalf of
Log: Fixed bug #75124 (gdImageGrayScale() may produce colors)
 [2017-08-27 12:20 UTC]
-Status: Analyzed +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Mar 03 15:01:28 2024 UTC