GD! Converting a png image to jpeg and making the alpha by default white and not black.

Posted by Shawn on Stack Overflow See other posts from Stack Overflow or by Shawn
Published on 2010-04-03T01:46:35Z Indexed on 2010/04/03 1:53 UTC
Read the original article Hit count: 333

I tried something like this but it just makes the background of the image white, not necessarily the alpha of the image. I wanted to just upload everything as jpg's so if i could somehow "flatten" a png image with some transparently to default it to just be white so i can use it as a jpg instead. Appreciate any help. Thanks.

$old = imagecreatefrompng($upload);
$background = imagecolorallocate($old,255,255,255);
imagefill($old, 0, 0, $background);
imagealphablending($old, false);
imagesavealpha($old, true);

© Stack Overflow or respective owner

Related posts about gd

Related posts about php