Bug #53580 [Asn]: During resize gdImageCopyResampled cause colors change

From: Date: Mon, 20 Jul 2015 14:02:46 +0000
Subject: Bug #53580 [Asn]: During resize gdImageCopyResampled cause colors change
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194572@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:             Assigned
 Type:               Bug
 Package:            GD related
 Operating System:   Windows, Ubuntu, CentOS, any?
 PHP Version:        5.2.16
 Assigned To:        pajoye
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[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


Thread (9 messages)

« previous php.bugs (#194572) next »