#41820 [Opn-Asn]: Color noise in resized image when using IMAGECOPYRESAMPLED

2007-07-02 Thread sniper
 ID:   41820
 Updated by:   [EMAIL PROTECTED]
 Reported By:  richard dot gavenda at rksting dot cz
-Status:   Open
+Status:   Assigned
 Bug Type: GD related
 Operating System: Windows XP
 PHP Version:  5.2.3
 Assigned To:  pajoye


Previous Comments:


[2007-06-28 10:14:26] richard dot gavenda at rksting dot cz

Ok, so let's close whis thread. I will wait for future versions :-)



[2007-06-28 10:12:15] richard dot gavenda at rksting dot cz

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.



[2007-06-28 10:08:08] [EMAIL PROTECTED]

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.4 and 126.5.

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] [EMAIL PROTECTED]

It is what I said, a rounding issue. I'm not sure yet how to make it
more portable.



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=41820edit=1


#41820 [Opn-Asn]: Color noise in resized image when using IMAGECOPYRESAMPLED

2007-06-27 Thread tony2001
 ID:   41820
 Updated by:   [EMAIL PROTECTED]
 Reported By:  richard dot gavenda at rksting dot cz
-Status:   Open
+Status:   Assigned
 Bug Type: GD related
 Operating System: Windows XP
 PHP Version:  5.2.3
-Assigned To:  
+Assigned To:  pajoye


Previous Comments:


[2007-06-27 10:08:39] richard dot gavenda at rksting dot cz

Title correction



[2007-06-27 10:07:40] richard dot gavenda at rksting dot cz

Description:

When resizing an image filled with solid color using
imagecopyresampled, a destination image is not filled with same solid
color, but with noise of two colors. I was tried this with grayscale
images. Second color in noise was exactly same as source color, but with
RGB channels lowered by 1. When the source image was filled with color,
which had RGB channels values equal to power of 2
(0,1,2,4,8,16,32,64,128) the noise disappears. 

Reproduce code:
---
$im = imagecreatetruecolor(1045,600);
$back = imagecolorallocate($im, 100, 100, 100);
imagefill($im, 0, 0, $back);
$im2 = imagecreatetruecolor(383,220);
imagecopyresampled($im2,$im,0,0,0,0,383,220,1045,600);
imagepng($im2);

Expected result:

PNG file filled with color 100,100,100(RGB)

Actual result:
--
PNG file filled with color noise of 100,100,100(RGB) and 99,99,99(RGB)





-- 
Edit this bug report at http://bugs.php.net/?id=41820edit=1