#41666 [Opn->Fbk]: imageTTFtext without Alpha
| From: | pajoye@php.net | Date: | Tue, 12 Jun 2007 11:45:20 +0000 |
| Subject: | #41666 [Opn->Fbk]: imageTTFtext without Alpha | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-113689@lists.php.net to get a copy of this message | ||
ID: 41666
Updated by: pajoye@php.net
Reported By: cyberline at techno4ever dot net
-Status: Open
+Status: Feedback
Bug Type: GD related
Operating System: Debian 3.1
PHP Version: 5.2.3
Assigned To: pajoye
New Comment:
Ok, I understand what you mean now.
There is two things. Per default gd does not save the alpha
information, you have to enable this mode using:
imagesavealpha($image, true);
The second problem is the blending mode while copying/resizing the
embed image. You have to disable the blending operation. Try:
<?php
$image = imagecreatetruecolor(222, 189);
$embed = imagecreatefrompng($logofile);
$white = imagecolorallocate($image, 255, 255, 255);
imagealphablending($image, 0);
imagecopyresized($image, $embed, 0, 0, 0, 0, 222, 189, imagesx($embed),
imagesy($embed));
imagettftext($image, 12, 0, 5, 15, $white, $font, $text);
imagesavealpha($image, true);
imagepng($image, $destfile);
imagedestroy($image);
Previous Comments:
------------------------------------------------------------------------
[2007-06-12 11:11:44] cyberline at techno4ever dot net
The fontfile:
http://web1.server02.quadrat4.de/federation.ttf
The logo:
http://web1.server02.quadrat4.de/logo.png
(I've tested other transparent PNG's with similar results)
Further i've added a sample text with ./arial.ttf
------------------------------------------------------------------------
[2007-06-12 10:59:19] pajoye@php.net
Please provide a link to the original "logo.png" image and to the TTF
file.
------------------------------------------------------------------------
[2007-06-12 09:43:16] cyberline at techno4ever dot net
Description:
------------
imageTTFtext has no alpha in case of using imageCreateFromPNG.
This was OK in PHP 5.2.1
Reproduce code:
---------------
http://web1.server02.quadrat4.de/phpbug/
Expected result:
----------------
Alphablending of the text
Actual result:
--------------
Rough Edges. Look at example.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41666&edit=1