#41820 [Ana->Opn]: Color noise in resized image when using IMAGECOPYRESAMPLED
| From: | richard dot gavenda at rksting dot cz | Date: | Thu, 28 Jun 2007 10:12:15 +0000 |
| Subject: | #41820 [Ana->Opn]: Color noise in resized image when using IMAGECOPYRESAMPLED | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-114403@lists.php.net to get a copy of this message | ||
ID: 41820
User updated by: richard dot gavenda at rksting dot cz
Reported By: richard dot gavenda at rksting dot cz
-Status: Analyzed
+Status: Open
Bug Type: GD related
Operating System: Windows XP
PHP Version: 5.2.3
Assigned To: pajoye
New Comment:
So there must be some sort of bug in resampling algorithm. When i
resizing bitmap filled with solid color in any bitmap editor, using any
aproximation (linear, bicubic, etc.) I get an image filled with exactly
same solid color.
With this issue I'm unable to reach one bit transparency of resized
image.
Previous Comments:
------------------------------------------------------------------------
[2007-06-28 10:08:08] pajoye@php.net
"Position of horizontal and vertical stripes is different on different
machines."
Yes, it is the problem with floating points value when we need a
constant and precise result on different architecture. See;
http://docs.sun.com/source/806-3568/ncg_goldberg.html
for a good
explanation about this problem.
For example, your images has variation between 126 and 127 for a given
channel. It may be only something like 126.49999 and 126.50000.
I don't think I can fix it easily for this implementation (bicubic
interpolation using floating points implementation).
Future versions will have more filters and using less volatile
precisions.
------------------------------------------------------------------------
[2007-06-28 10:00:33] richard dot gavenda at rksting dot cz
Position of horizontal and vertical stripes is different on different
machines.
------------------------------------------------------------------------
[2007-06-28 09:58:20] pajoye@php.net
It is what I said, a rounding issue. I'm not sure yet how to make it
more portable.
------------------------------------------------------------------------
[2007-06-28 09:53:41] richard dot gavenda at rksting dot cz
AMD 32, Windows XP, PHP 5.2.3 - bug present
x86 64, Centos 4, PHP 4.3.9 - bug present
x86 32, Fedora Core 5, PHP 5.1.6 - bug present
Source image 800x600 filled with RBG(127,127,127):
target image 800x600 - OK
http://81.200.49.53:25459/resample.php?w=800&h=600&c=127
target image 701x600 - vertical stripes
http://81.200.49.53:25459/resample.php?w=701&h=600&c=127
target image 800x501 - horizontal stripes
http://81.200.49.53:25459/resample.php?w=800&h=501&c=127
target image 701x501 - noise
http://81.200.49.53:25459/resample.php?w=701&h=501&c=127
"When is source image filled with RGB values equal to power of 2
(0,1,2,4,8,16,32,64,128) the noise disappears", this rule i can
reproduce only on AMD 32 architecture. On other platform is noise
present regardless of fill color.
------------------------------------------------------------------------
[2007-06-28 07:29:29] pajoye@php.net
CopyResampled using floating points to calculate the destination color.
It may result to rounding problem. However I cannot reproduce this
problem on my development platforms (x86 32 and 64bit, amd 64).
What's your architecture?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/41820
--
Edit this bug report at http://bugs.php.net/?id=41820&edit=1