#20847 [Opn->Csd]: subimages made from transparent images aren' transparent
| From: | pajoye@php.net | Date: | Fri, 06 Dec 2002 01:19:03 +0000 |
| Subject: | #20847 [Opn->Csd]: subimages made from transparent images aren' transparent | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-26809@lists.php.net to get a copy of this message | ||
ID: 20847
Updated by: pajoye@php.net
Reported By: gid@gifpaste.net
-Status: Open
+Status: Closed
Bug Type: GD related
Operating System: Debian (sid) Linux 2.4.20
PHP Version: 4.3.0RC2
-Assigned To:
+Assigned To: pajoye
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
hello,
You may use color to draw something in a image, not only alpha
channels. Paint program shows you a black/gray for ot as a
convenience.
Try to redraw your letter with real color (even with transparancy) and
it will work.
Thank's for your report.
pierre
Previous Comments:
------------------------------------------------------------------------
[2002-12-05 17:52:48] gid@gifpaste.net
Additional note: If I try to directly copy the transparent png image
over the photo image, it works like a charm, it's only when I need to
create an intermediate subimage that it doesn't work.
------------------------------------------------------------------------
[2002-12-05 17:49:10] gid@gifpaste.net
I'm running 4.3.0RC2 with the built in gd library.
What I'm trying to do is create a transparent subimage from a series of
pngs that have an 8 bit alpha channel. I then can resize the subimage,
rotate it, whatever over another photograph.
I realize there's the imagecolortransparent() function so you can
specify one color on your image as transparent, but this does not help
the case when you want full 8-bit transparency.
Expected results: The subimage should have an 8-bit alpha channel like
the png's that's it's created from and should be transparent when
imagecopy()'d over the photoimage.
Actual results: I get a black box where I tried to copy the image.
Web page source: http://pimpbot.qooqle.com/gid/php_bug1/
(example png and jpg images I used are loacated here)
Example source:
<?
// load photo image
$photo_img = imagecreatefromjpeg('images/kittybath.jpg');
imagealphablending($photo_img, TRUE);
// load just one letter for now to test
// this is a transparent png with an 8 bit alpha channel
$letter_img = imagecreatefrompng('images/S.png');
imagealphablending($letter_img, TRUE);
$x = imagesx($letter_img);
$y = imagesy($letter_img);
// create the words image, same size as the letter for now
// this is also referred to as the subimage, it should also have an 8
bit alpha channel
// like the letter_img
$words_img = imagecreate($x, $y);
imagepalettecopy($words_img, $letter_img);
imagealphablending($words_img, TRUE);
// copy letter image onto words image
imagecopy($words_img, $letter_img, 0, 0, 0, 0, $x, $y);
// now that we have the words image, we can resize it, rotate it, etc
// but we won't do that for now to keep things simple
// copy words image onto photo image
imagecopy($photo_img, $words_img, 50, 50, 0, 0, $x, $y);
// write out new image
imagejpeg($photo_img, 'images/new.jpg', 90);
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20847&edit=1