#34336 [Asn->Fbk]: ext/gd: imagerotate destroys transparency information

From: Date: Fri, 02 Sep 2005 08:10:11 +0000
Subject: #34336 [Asn->Fbk]: ext/gd: imagerotate destroys transparency information
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-84396@lists.php.net to get a copy of this message
 ID:               34336
 Updated by:       pajoye@php.net
 Reported By:      techtonik@php.net
-Status:           Assigned
+Status:           Feedback
 Bug Type:         Feature/Change Request
 Operating System: *
 PHP Version:      5CVS, 4CVS (2005-08-31)
 Assigned To:      pajoye
 New Comment:

Please try using this CVS snapshot:

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


Try the newly added 4th argument:

imagerotate($rsr, $angle, $bg_color, $keeptransparency);

However, note that this is interpolated colors in the destination
images (rotated), meaning that if the original image has some
antialiased artifacts with the bgd color, you will notice them in the
rotated image (in your case, a white border), not much can be done
against that.

--Pierre




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

[2005-09-01 21:41:26] techtonik@php.net

Description:
------------
Imagerotate doesn't preserve transparency information.
Next image was used in example below:
http://img24.imageshack.us/img24/228/spritepaw8alpha2os.png


Reproduce code:
---------------
<?php

$sprName = "sprite_paw8_alpha.png";
$spr = imagecreatefrompng($sprName); //create sprite object

//get sprite's transparent color
$sprTransparent = imagecolortransparent($spr);

//sprite rotation
$rotate = 15;
//rotate sprite, ?keeping transparent pixels
$spr = imagerotate($spr, $rotate, $sprTransparent); 

header("Content-type: image/gif");
imagegif($spr);
imagedestroy($spr);

?>

Expected result:
----------------
Rotated image with transparent background.

Actual result:
--------------
Rotated image with black background.


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


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


Thread (11 messages)

« previous php.bugs (#84396) next »