#45030 [Opn->Fbk]: Destination image alpah channle noise when using imagecopyresampled
| From: | pajoye@php.net | Date: | Sat, 17 May 2008 22:43:05 +0000 |
| Subject: | #45030 [Opn->Fbk]: Destination image alpah channle noise when using imagecopyresampled | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-125073@lists.php.net to get a copy of this message | ||
ID: 45030
Updated by: pajoye@php.net
Reported By: lieyang at yahoo dot com
-Status: Open
+Status: Feedback
Bug Type: GD related
Operating System: x86_64 GNU/Linux Kernel 2.6.9-4
PHP Version: 5.2.6
-Assigned To:
+Assigned To: pajoye
New Comment:
Please provide me the source image and the result you get. You can use
http://bugs.libgd.org as well as you can add attachments to your
report.
Previous Comments:
------------------------------------------------------------------------
[2008-05-17 21:43:31] lieyang at yahoo dot com
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 this bug report at http://bugs.php.net/?id=45030&edit=1