From:             [EMAIL PROTECTED]
Operating system: Mac OS X 10.2.3
PHP version:      4.3.0
PHP Bug Type:     GD related
Bug description:  imagecolortransparent &/or imagecolorallocate not working with 2- 
and 4-bit png

In the following script:

<?php
$image2 = ImageCreateFromPNG('images/Monsters/Orc.png');
$image = ImageCreateFromPNG('images/Board.png');
$black = ImageColorAllocate($image2, 0, 0, 0);

imagecolortransparent($image2, $black);
imagecopy($image, $image2, 40*2+8, 40*2+8, 0, 0, 39, 39);

header("Content-type: image/png");
ImagePNG($image);
imagedestroy($image);
imagedestroy($image2);
?>

what I expect to happen is that the black in the 'Orc.png' image will
become transparent when it is copied onto 'Board.png'. This doesn't
happen. The transparency is not recognized at all.

More info:
Orc.png is a 2-bit PNG, with black occupying two of the colors. (It
doesn't work even if it only has one.)
Board.png is a 4-bit PNG with 6 distinct colors (11 copies of black).
If I change the line to

imagecolortransparent('$image2, imagecolorat($image2, 0, 0);

it works correctly. If I change the line use either 2 or 3, as in

imagecolortransparent('$image2, 3);

it works depending on which black (index no. 2 or 3) is actually in the
image. There may be no way around this except to have
imagecolortransparent check by RGB values rather than an index number.
-- 
Edit bug report at http://bugs.php.net/?id=21763&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=21763&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=21763&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=21763&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=21763&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=21763&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=21763&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=21763&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=21763&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=21763&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=21763&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21763&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=21763&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=21763&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=21763&r=gnused

Reply via email to