drisate Posted May 28, 2009 Share Posted May 28, 2009 Hey guys ... is there any other way of doing this with out using imagetruecolortopalette? The qualaty output is awful ... $simg = imagecreatefromjpeg("$idir" . $url); $currwidth = imagesx($simg); $currheight = imagesy($simg); if ($currheight > $currwidth) { $zoom = $twidth / $currheight; $newheight = $theight; $newwidth = $currwidth * $zoom; } else { $zoom = $twidth / $currwidth; $newwidth = $twidth; $newheight = $currheight * $zoom; } $dimg = imagecreate($newwidth, $newheight); imagetruecolortopalette($simg, false, 256); $palsize = ImageColorsTotal($simg); for ($i = 0; $i < $palsize; $i++) { $colors = ImageColorsForIndex($simg, $i); ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']); } imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); imagejpeg($dimg, "$tdir" . $url); imagedestroy($simg); imagedestroy($dimg); Link to comment https://forums.phpfreaks.com/topic/160070-imagetruecolortopalette/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.