From:             lieyang at yahoo dot com
Operating system: x86_64 GNU/Linux Kernel 2.6.9-4
PHP version:      5.2.6
PHP Bug Type:     GD related
Bug description:  Destination image alpah channle noise when using 
imagecopyresampled

Description:
------------
When resizing a 24 bit png image with imagecopyresampled, the destination
image alpha channel contains noise where it should be completely
transparent. When the re-sized image is displayed on Motorola phones with
only 4 levels of transparency, 
the image shows many dark dots.

If we replace imagecopyresampled with imagecopyresized in the following
sample reproduce code, the problem goes away.

Reproduce code:
---------------
 
$imageSrc = imagecreatefromstring($imageData);

$imageDst = imagecreatetruecolor($width, $height);
imagealphablending($imageDst, false);
$color = imagecolorallocatealpha($imageDst, 0, 0, 0, 127);
imagefill($imageDst, 0, 0, $color);
imagesavealpha($imageDst, true);

imagecopyresampled($imageDst,$imageSrc, $dst_x, $dst_y, $src_x,
$src_y, $dst_w, $dst_h, $src_w, $src_h);

Expected result:
----------------
Completely transparent regions should still be completely transparent in
destination image.

Actual result:
--------------
Destination image alpha channel noise (some pixel values that should be
fully transparent have different value "2").
You can see the noise all over the transparent regions with any graphics
tools (for example, color selection with gimp).


-- 
Edit bug report at http://bugs.php.net/?id=45030&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45030&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45030&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45030&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45030&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45030&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45030&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45030&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45030&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45030&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45030&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45030&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45030&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45030&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45030&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45030&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45030&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45030&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45030&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45030&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45030&r=mysqlcfg

Reply via email to