Ask a Question related to PHP Bugs, Design and Development.
-
seth at pricepages dot org #1
#40601 [NEW]: imagesavealpha() has opposite effect on transparent color
From: seth at pricepages dot org
Operating system: Mac 10.4
PHP version: 5.2.1
PHP Bug Type: GD related
Bug description: imagesavealpha() has opposite effect on transparent color
Description:
------------
The function imagesavealpha() has an opposite effect on the
output image if the color is marked as transparent. For
example, the code below should always create a clear image.
But it renders as black.
The interesting thing is that if you remove the imagesavealpha
, the image renders as expected (clear).
Reproduce code:
---------------
<?php
$img = imagecreatetruecolor(100,100);
$trans = imagecolorresolve($img,0,0,0);
imagecolortransparent($img, $trans);
imagealphablending($img, false);
imagefilledrectangle($img, 0,0, 100,100, $trans);
//Has opposite affect
imagesavealpha($img,true);
header('Content-Type: image/png');
imagepng($img);
?>
Expected result:
----------------
nothing (a clear image)
Actual result:
--------------
a solid black image
--
Edit bug report at [url]http://bugs.php.net/?id=40601&edit=1[/url]
--
Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40601&r=trysnapshot44[/url]
Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40601&r=trysnapshot52[/url]
Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40601&r=trysnapshot60[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40601&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=40601&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=40601&r=needtrace[/url]
Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40601&r=needscript[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=40601&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=40601&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=40601&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=40601&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=40601&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=40601&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40601&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=40601&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=40601&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40601&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=40601&r=float[/url]
No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40601&r=nozend[/url]
MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40601&r=mysqlcfg[/url]
seth at pricepages dot org Guest
-
How do I make a box a transparent or opaque color
I want to create a box to identify a spot on an aerial map, but I want the color box to be somewhat transparent. In photoshop I can control the... -
Transparent areas show up as off color
When I export an InDesign document to PDF (Acrobat 6) and then print on a color printer, the transparent areas show up as a slightly different color.... -
Color to Transparent Gradient
Hello, can you tell me how can I make a gradient like in Photoshop from a normal 100% opacity color to transparent. Thanx -
Transparent to color gradient for a photo
I've just started trying to learn InDesign. I have a photo in a project that I want the right side to blend into a solid color. I've tried to create... -
can i make an effect the opposite of a mask?
In my game I'm trying to make a 'fog of war' type of effect. The way I want to do it is have a shape that cuts out a peice of a black rectangle. ... -
pajoye@php.net #2
#40601 [Opn->Bgs]: imagesavealpha() has opposite effect on transparent color
ID: 40601
Updated by: [email]pajoye@php.net[/email]
Reported By: seth at pricepages dot org
-Status: Open
+Status: Bogus
Bug Type: GD related
Operating System: Mac 10.4
PHP Version: 5.2.1
-Assigned To:
+Assigned To: pajoye
New Comment:
Transparent color and alpha cannot work together when you save a file.
PNG supports one or another not both (PNG is also the only format
supporting alpha).
You will get a warning/error in libpng if you try to do the same calls
(for example in C).
not a bug > bogus.
Previous Comments:
------------------------------------------------------------------------
[2007-02-23 03:04:57] seth at pricepages dot org
Description:
------------
The function imagesavealpha() has an opposite effect on the
output image if the color is marked as transparent. For
example, the code below should always create a clear image.
But it renders as black.
The interesting thing is that if you remove the imagesavealpha
, the image renders as expected (clear).
Reproduce code:
---------------
<?php
$img = imagecreatetruecolor(100,100);
$trans = imagecolorresolve($img,0,0,0);
imagecolortransparent($img, $trans);
imagealphablending($img, false);
imagefilledrectangle($img, 0,0, 100,100, $trans);
//Has opposite affect
imagesavealpha($img,true);
header('Content-Type: image/png');
imagepng($img);
?>
Expected result:
----------------
nothing (a clear image)
Actual result:
--------------
a solid black image
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=40601&edit=1[/url]
pajoye@php.net Guest



Reply With Quote

