php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30662 Unable to fill true color image with a high-alpha color (imagealphablending on)
Submitted: 2004-11-02 16:10 UTC Modified: 2004-11-19 11:08 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: ibrash at gmail dot com Assigned: pajoye (profile)
Status: Closed Package: GD related
PHP Version: 5.0.2 OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
20 - 9 = ?
Subscribe to this entry?

 
 [2004-11-02 16:10 UTC] ibrash at gmail dot com
Description:
------------
It seems that imagefill doesn't deal well with highly-transparent colors, causing PHP to use 100% of CPU and never finish executing the imagefill (i.e., seems like an infinite loop).  Anything at or above an alpha setting of 85 in the imagecolorallocatealpha call seems to trigger this behavior.

Tested on both Linux (built from source) and Windows XP (php.net packaged version) with same results.

Configure line on Linux is
./configure --with-gd --with-jpeg-dir --with-zlib-dir

Reproduce code:
---------------
<?php
$im = imagecreatetruecolor(400, 400);
imagealphablending($im, true);
$background = imagecolorallocatealpha($im, 255, 255, 255, 127);
imagefill($im, 0, 0, $background);
?>

Expected result:
----------------
Script to run to completion.

Actual result:
--------------
Script never ends (unless max_execution_time is set, of course)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-19 11:08 UTC] pajoye@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Fixed in HEAD. Merge to 5.0.x branch over the weekend.

--Pierre
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 15:01:29 2024 UTC