Bug #51671 [Fbk]: imagefill does not work correctly for small images
| From: | pajoye@php.net | Date: | Tue, 27 Apr 2010 18:40:46 +0000 |
| Subject: | Bug #51671 [Fbk]: imagefill does not work correctly for small images | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-149968@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51671&edit=1
ID: 51671
Updated by: pajoye@php.net
Reported by: a dot schilder at gmx dot de
Summary: imagefill does not work correctly for small images
Status: Feedback
Type: Bug
Package: GD related
Operating System: Windows XP SP3
PHP Version: 5.3.2
Assigned To: pajoye
New Comment:
I removed the note in the doc.
Previous Comments:
------------------------------------------------------------------------
[2010-04-27 19:57:06] a dot schilder at gmx dot de
I think you mean the doc of another function?
The doc for "imagecreatetruecolor" says "This function will not work
with GIF file formats." in the notes section (see:
http://php.net/manual/en/function.imagecreatetruecolor.php).
The note in the docs should be unrelated to this bug, because IMHO it
doesn't make sense - but as I also mentioned, the problem disappeared
after replacing "imagecreatetruecolor" with "imagecreate", so there
seems to be a relation to the used function.
------------------------------------------------------------------------
[2010-04-27 13:14:19] pajoye@php.net
Which part of the doc says that you can't create gif from true color
images?
As far as I remember the doc is about which buffer format is created
when a script load a GIF image. imagecreatefromgif always returns a
palette image.
Also this question is unrelated to this problem.
------------------------------------------------------------------------
[2010-04-27 13:11:59] a dot schilder at gmx dot de
I also tested it with imagecreate() instead of imagecreatetruecolor()
and then it worked. Although it's said in the docs that
imagecreatetruecolor() does not work with gif images, that's not true -
it works in all cases, except in this example (see also bug #51414 for
this doc problem).
The code is taken from a class that creates an image and outputs it in
different formats - so imagecreatetruecolor() has to be used, because
the output format is not known on image creation.
------------------------------------------------------------------------
[2010-04-27 09:22:01] a dot schilder at gmx dot de
Description:
------------
I try to use imagefill() with an image that has a width of one pixel,
but it does not work. For larger image it works as expected.
Test script:
---------------
// image 1
$image = imagecreatetruecolor(50, 50);
$white = imagecolorallocate($image, 255, 255, 255);
imagefill($image, 0, 0, $white);
imagegif($image, __DIR__ . '/50x50.gif');
// image 2
$image = imagecreatetruecolor(1, 50);
$white = imagecolorallocate($image, 255, 255, 255);
imagefill($image, 0, 0, $white);
imagegif($image, __DIR__ . '/1x50.gif');
Expected result:
----------------
1) White image, 50x50 pixel.
2) White image, 1x50 pixel.
Actual result:
--------------
1) White image, 50x50 pixel.
2) Image, 1x50 pixel, with the first two pixels (0/0, 1/0) in white, the
rest in the default color (black).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51671&edit=1