php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30595 Imagecopyresampled function bug
Submitted: 2004-10-28 11:02 UTC Modified: 2004-11-19 13:16 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: lunter at interia dot pl Assigned: pajoye (profile)
Status: Not a bug Package: GD related
PHP Version: 5.0.2 OS: WinXP SP2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lunter at interia dot pl
New email:
PHP Version: OS:

 

 [2004-10-28 11:02 UTC] lunter at interia dot pl
Description:
------------
Imagecopyresampled function bug:

Original image: Any one-color square.
After resized (reduce 1 pixel width and heihgt): Two colors square with noise !!!

Example with PHP code:
http://www.pc44.pl/goorol/ImagecopyresampledBug.zip

Reproduce code:
---------------
<?
 $im=imagecreatefrompng('original.png'); // 100x100 one-color square
 $re=imagecreatetruecolor(99,99); 
 imagecopyresampled($re,$im,0,0,0,0,99,99,imagesx($im),imagesy($im));
 imagepng($re,'resized.png');
?>

http://www.pc44.pl/goorol/ImagecopyresampledBug.zip

Expected result:
----------------
One-color 99x99 square.

Actual result:
--------------
Two-colors with NOISE 99x99 square.

Example with PHP code:
http://www.pc44.pl/goorol/ImagecopyresampledBug.zip

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-19 13:16 UTC] pajoye@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

imagecopyresampled uses a resampling using weight of each original pixels in the destination image. That means even by resizing by a ratio of 0.99, you will have part of the image that will differ, in your case the edges of your square.

--Pierre
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 21:01:35 2025 UTC