note 77098 added to function.imagecolortransparent
| From: | Mikasto at osu1 dot php dot net | Date: | Wed, 15 Aug 2007 11:51:56 +0000 |
| Subject: | note 77098 added to function.imagecolortransparent | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129490@lists.php.net to get a copy of this message | ||
To resize transparent PNG (if image is transparent & ImageColorTransparent() returns -1):
1) create a new image with the new sizes
2) make the new image all transparent
3) turn off the alpha blending for the new image (to keep the alpha channel when copy data)
4) do copyresampled or copyresized into new image
PHP code:
// 1
$im2 = ImageCreateTrueColor($w, $h);
// 2
ImageColorTransparent($im2, ImageColorAllocate($im2, 0, 0, 0));
// 3
ImageAlphaBlending($im2, false);
// 4
ImageCopyResampled($im2, $im, 0, 0, 0, 0, $w, $h, ImageSX($im), ImageSY($im));
or see this http://alexle.net/archives/131
----
Server IP: 69.147.83.197
Probable Submitter: 217.21.216.155
----
Manual Page -- http://www.php.net/manual/en/function.imagecolortransparent.php
Edit -- https://master.php.net/note/edit/77098
Del: integrated -- https://master.php.net/note/delete/77098/integrated
Del: useless -- https://master.php.net/note/delete/77098/useless
Del: bad code -- https://master.php.net/note/delete/77098/bad+code
Del: spam -- https://master.php.net/note/delete/77098/spam
Del: non-english -- https://master.php.net/note/delete/77098/non-english
Del: in docs -- https://master.php.net/note/delete/77098/in+docs
Del: other reasons-- https://master.php.net/note/delete/77098
Reject -- https://master.php.net/note/reject/77098
Search -- https://master.php.net/manage/user-notes.php