ID:               39273
 Updated by:       [EMAIL PROTECTED]
 Reported By:      seth at pricepages dot org
-Status:           Open
+Status:           Feedback
 Bug Type:         GD related
 Operating System: Mac 10.4
 PHP Version:      5.1.6
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip




Previous Comments:
------------------------------------------------------------------------

[2006-10-27 04:17:23] seth at pricepages dot org

Description:
------------
imagecopyresampled() should be copying the alpha channel, but 
it doesn't seem to be doing so. This is a palette based source 
image being copied to a true color image.

If you use imagecopy() instead, the image copies as expected 
(mostly).

Reproduce code:
---------------
<?php
$small = imagecreatefrompng('http://leopold.sage.wisc.edu/test.png');

$width = 300;
$height = 300;
$srcW = imagesx($small);
$srcH = imagesy($small);

$img = imagecreatetruecolor($width, $height);

//Make a transparent canvas
$trans = imagecolorresolve($img,255,255,255);
imagecolortransparent($img, $trans);
imagealphablending($img, false);
imagefilledrectangle(   $img,
                                                0, 0,
                                                $width, $height,
                                                $trans);

//This shouldn't *need* to be on, but it does
imagealphablending($img, true);

//One of these works, the other doesn't
//imagecopy($img, $small, 0,0, 0,0, $srcW, $srcH);
imagecopyresized($img, $small, 0,0, 0,0, $width, $height, $srcW,
$srcH);

header('Content-Type: image/png');
imagepng($img);
?>

Expected result:
----------------
An enlarged, pixellated, mostly transparent, image.

Actual result:
--------------
A black, opaque, image.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39273&edit=1

Reply via email to