I use imagetruecolortopallete to reduce the image from 24-bit rgb to 8-bit rgb, but the result is not beautiful just like tinypng.com, how can I do this?
source image 24 bit rgb
convert 8 bit rgb image to my code


image 8 bit rgb convert by tinypng.com

[Spectrum]: sorry for not the whole image, but I lost my patience, the source link is too slow / unstable (it took ~ 20 minutes after the 3rd attempt to download it ...)
<?php
$im = imagecreatetruecolor(1024, 768);
imagetruecolortopalette($im, true, 255);
imagepng($im, 'cat.png');
imagedestroy($im);
?>
source
share