Edit report at https://bugs.php.net/bug.php?id=60160&edit=1
ID: 60160 Updated by: f...@php.net Reported by: kieran at menor dot dk Summary: imagefill() doesn't work correctly for small images -Status: Open +Status: Analyzed Type: Bug Package: GD related Operating System: Windows 7 x64, Debian 6 x64 PHP Version: 5.3.8 Block user comment: N Private report: N New Comment: Related to https://bugs.php.net/51671 - that didn't get fixed completely, as can be seen in the test for #51671. Previous Comments: ------------------------------------------------------------------------ [2011-10-31 14:51:05] f...@php.net The following patch has been added/updated: Patch Name: fix-imagefill-for-images-smaller-than-4px-width Revision: 1320072664 URL: https://bugs.php.net/patch-display.php?bug=60160&patch=fix-imagefill-for-images-smaller-than-4px-width&revision=1320072664 ------------------------------------------------------------------------ [2011-10-28 17:39:06] kieran at menor dot dk Workaround: ------------ Use imagefilledrectangle() instead, alike so: function imagefillfix($image, $x, $y, $color) { return imagefilledrectangle($image, $x, $y, imagesx($image) - 1, imagesy($image) - 1, $color); } ------------------------------------------------------------------------ [2011-10-28 17:30:08] kieran at menor dot dk Description: ------------ imagefill() doesn't work correctly for images with a width lower than 4 pixels. Image height makes no difference. Test script: --------------- <?php header('Content-Type: image/png'); $im = imagecreatetruecolor(3, 3); imagefill($im, 0, 0, imagecolorallocate($im, 255, 255, 255)); imagepng($im); imagedestroy($im); Expected result: ---------------- Completely white 3x3 pixels image expected. Actual result: -------------- Upper and left edge white, 2x2 black square in lower right corner. http://caffie.net/broken.php ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60160&edit=1