Bug #75124 [Opn->Ana]: gdImageGrayScale() may produce colors

From: Date: Sun, 27 Aug 2017 11:37:48 +0000
Subject: Bug #75124 [Opn->Ana]: gdImageGrayScale() may produce colors
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210830@lists.php.net to get a copy of this message
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: Open +Status: Analyzed Type: Bug Package: GD related Operating System: * PHP Version: 7.0.22 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N 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

« previous php.bugs (#210830) next »