Scaling image is losing background transparency
- From: "laredotornado@xxxxxxxxxxx" <laredotornado@xxxxxxxxxxx>
- Date: Fri, 14 Jan 2011 10:56:28 -0800 (PST)
Hi,
I'm using PHP 5 and trying to scale png images programatically. Here
is what I'm doing ...
$src_img = imagecreatefrompng($imagefile);
$hw = getimagesize($imagefile);
$new_w = $w;
$new_h = $hw["1"]/($hw["0"]/$w);
$dst_img = @imagecreatetruecolor($new_w, $new_h);
if(!$dst_img) {
$dst_img = imageCreate($new_w, $new_h);
}
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,
$new_h,imagesx($src_img),imagesy($src_img));
imagepng($dst_img);
The problem is my scaled png image loses its background transparency.
The short of this is, does anyone know how to scale PNG images
effectively and what other information can I provide to help
troubleshoot this further?
Thanks, - Dave
.
- Follow-Ups:
- Re: Scaling image is losing background transparency
- From: Chuck Anderson
- Re: Scaling image is losing background transparency
- From: Thomas 'PointedEars' Lahn
- Re: Scaling image is losing background transparency
- Prev by Date: Re: [urgent] need solution of Questions, in context of PHP5
- Next by Date: Re: input a section of a large file
- Previous by thread: input a section of a large file
- Next by thread: Re: Scaling image is losing background transparency
- Index(es):