<?php
bool imagetruecolortopalette ( GdImage $image, bool $dither, int $num_colors )
where,
$image = An image identifier
$dither = To control if the image will be dithered or not
$num_colors = The maximun number of colors that
should be retained in the palette
?>
<?php
echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';
$lang = 'en';
$tst_img01 = "png/PNG 081 01.png";
$dst_img01 = "gif/GIF 027 01.gif";
$dith = TRUE;
$colors = 256;
$id_wv01 = imagecreatefrompng($tst_img01);
$is_tc = imageistruecolor($id_wv01);
if($is_tc == FALSE)
{
$en = '<br><br>Is not a TRUECOLOR IMAGE';
echo $tst_img01 . $$lang; ?>
<br><br><img src="<?php echo $tst_img01; ?>"
alt="<?php echo $tst_img01; ?>" width="400"><br><br><br><br>
<?php
}
else
{
$en = '<br><br>TRUECOLOR IMAGE';
echo $tst_img01 . $$lang; ?>
<br><br><img src="<?php echo
$tst_img01; ?>" alt="<?php echo $tst_img01; ?>" width="400">
<br><br><br><br>
<?php
imagetruecolortopalette($id_wv01, $dith, $colors);
imagegif($id_wv01, $dst_img01);
$en = '<br><br>PALETTE IMAGE';
echo $dst_img01 . $$lang; ?>
<br><br><img src="<?php echo
$dst_img01; ?>" alt="<?php echo $dst_img01; ?>" width="400"><br>
<?php
}
?>