Acceptably Converting a 24bit PNG to a JPEG?
| From: | Graham Anderson | Date: | Fri, 01 Dec 2006 22:26:36 +0000 |
| Subject: | Acceptably Converting a 24bit PNG to a JPEG? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-245435@lists.php.net to get a copy of this message | ||
Is there some trick to getting PHP GD to properly convert a 24bit PNG[with alpha] into a JPEG without garbling the image output?
The below will output the jpg image, but it appears that the alpha channel from the original png is garbling the jpeg a bit
To no avail, I tried setting imageAlphaBlending and imageSaveAlpha to 'false' and 'true'
I also tried setting the jpeg quality to 90 and 100.
$image_output = "myimage.jpeg";
$image = imagecreatefrompng($original_24bit_png_image);
imageAlphaBlending($image, true);
imageSaveAlpha($image, true);
header("Content-type: image/jpeg");
imagejpeg($image,'',100);
imagedestroy($image);
many thanks in advance
g