Re: Why no color in graphic?

From: Date: Tue, 31 Jul 2001 05:16:03 +0000
Subject: Re: Why no color in graphic?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-60336@lists.php.net to get a copy of this message
> I'm simply trying to resize an image, which is working - sortof. It resizes > properly, but it loses it's color. Why, and how do I correct it? Thanks. > > <? > $pic_dir = "_uimages"; > $picture = "$pic_dir/mypic.jpg"; > $size = GetImageSize($picture); > $width = round($size[0]/4); > $height = round($size[1]/4); > $im = ImageCreate($width,$height); > $im_o = ImageCreateFromJPEG($picture);; > ImageCopyResized($im,$im_o,0,0,0,0,$width,$height,$size[0],$size[1]); > imagedestroy($im_o); > ImageJPEG($im); > imagedestroy($im); > ?> Your $im does not have the same pallette of colors as the original... You'll need to copy over the pallette first somehow. -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#60336) next »