Possible bug in imagefill()

From: Date: Wed, 03 Mar 2010 19:22:32 +0000
Subject: Possible bug in imagefill()
Groups: php.gd.devel 
Request: Send a blank email to php-gd-devel+get-648@lists.php.net to get a copy of this message
I noticed some strange behavior today with GD on one of my systems. We are using PHP 5.3.1 on Linux. phpinfo() tells me that our version of GD is "bundled (2.0.34 compatible)". Here's the problem: when creating an image that is less than 4 pixels wide and filling it with a color, only the top 2 rows of pixels are filled with the desired color (see attached images). This code produces the bad image for me: <?php $im = imagecreatetruecolor(3, 100); $red = imagecolorallocate($im, 255, 0, 0); imagefill($im, 0, 0, $red); header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?> This code produces the image that is correctly filled: <?php $im = imagecreatetruecolor(4, 100); $red = imagecolorallocate($im, 255, 0, 0); imagefill($im, 0, 0, $red); header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?> I tested this using imagejpeg() and imagegif() and the results are effectively the same. In the meantime, I switched to using imagefilledrectangle() instead of imagefill(). I don't know if this is helpful information, but this seems to work fine on PHP 5.1.2 on Linux with GD bundled (2.0.28 compatible). Please let me know if you need any more information or if there is anything I can do to help. Thanks! Joe

« previous php.gd.devel (#648) next »