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); Quote Link to comment https://forums.phpfreaks.com/topic/160070-imagetruecolortopalette/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.