NYCPHP Meetup

NYPHP.org

[nycphp-talk] Gif -> Png or Jpeg

Kshitij Bedi Kbedi at inta.org
Mon Jun 28 17:03:15 EDT 2004


This code works very well, though for images that have any black in them
which originally have a white background
the background of the converted image turns black. What to do there?

-----Original Message-----
From: Rolan Yang [mailto:rolan at omnistep.com]
Sent: Friday, June 25, 2004 5:52 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Gif -> Png or Jpeg


Here's a snippet of code from stuff i use. Hope it helps:

$im=@ImageCreateFromjpeg($imgurl))    or      
$im=@ImageCreateFromgif($imgurl);

if ($imgtype=="jpg") {imagejpeg($im,'',85);} else 
{imageTrueColorToPalette($im,1,256);imagepng($im);}

Kshitij Bedi wrote:

>Any Ideas on converting Gif to Png or Jpeg using PHP GD?
>_______________________________________________
>talk mailing list
>talk at lists.nyphp.org
>http://lists.nyphp.org/mailman/listinfo/talk
>
>  
>
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk



More information about the talk mailing list