NYCPHP Meetup

NYPHP.org

[nycphp-talk] Gif -> Png or Jpeg

Rolan Yang rolan at omnistep.com
Mon Jun 28 20:56:47 EDT 2004


Are you outputting as png or jpg? When downconverting to 256 colors, you 
might experience pallete rot.
Try $imgtype="'jpg";

~Rolan

Kshitij Bedi wrote:

>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]
>
>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?
>>
>>    
>>



More information about the talk mailing list