Bug #53580 [Sus->Opn]: During resize gdImageCopyResampled cause colors change
| From: | cmb@php.net | Date: | Wed, 25 Aug 2021 12:02:39 +0000 |
| Subject: | Bug #53580 [Sus->Opn]: During resize gdImageCopyResampled cause colors change | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-236064@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=53580&edit=1
ID: 53580
Updated by: cmb@php.net
Reported by: chupakabr at gmail dot com
Summary: During resize gdImageCopyResampled cause colors
change
-Status: Suspended
+Status: Open
Type: Bug
Package: GD related
Operating System: Windows, Ubuntu, CentOS, any?
PHP Version: 5.2.16
Block user comment: N
Private report: N
New Comment:
The issue has been fixed upstream (not yet released, though), so
it may be ported.
Previous Comments:
------------------------------------------------------------------------
[2016-08-21 19:33:18] cmb@php.net
This bug has already been reported as
<https://github.com/libgd/libgd/issues/99>, so
I'm suspending this
ticket.
------------------------------------------------------------------------
[2015-07-20 14:02:46] cmb@php.net
IMHO it makes sense to apply rounding (instead of truncation) in
this case, but we might need a fallback for lround() for older
compilers. And interestingly, some quick tests (script from bug
#41820) on Win7/VC14 cause all pixels to be rounded to 0x636363.
Still better than having two colors, but weird.
------------------------------------------------------------------------
[2010-12-20 09:45:26] chupakabr at gmail dot com
Description:
------------
Reproduce:
To test resize image containing solid white background. After resize pixels with
color different from #FFFFFF will appear.
Probable cause:
gdImageSetPixel parameters (red, green, blue, alpha) are casted to int in
gdImageCopyResampled which cause them to floor so 254.9999999 became 254 instead
of 255.
Issues seem to be related:
http://bugs.php.net/bug.php?id=30591
http://bugs.php.net/bug.php?id=41820
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=53580&edit=1