<?php
bool imagepalettetotruecolor ( GdImage $image )
where,
$image = An image identifier
?>
<?php
echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';
$src_img01 = "gif/GIF 027 01.gif";
$tgt_img01 = "jpeg/JPEG 039 01.jpg";
$id_src01 = imagecreatefromgif($src_img01);
$nbr_colors_src01 = imagecolorstotal($id_src01);
$get_info_src01 = getimagesize($src_img01);
$mime_type_src01 = $get_info_src01["mime"];
echo $src_img01 . '<br><br>PALETTE IMAGE' . '( ' .
$mime_type_src01 . ' )<br>' .
$nbr_colors_src01 . ' colors'; ?>
<br><br><img src="<?php echo $src_img01; ?>"
alt="<?php echo $src_img01; ?>" width="400">
<br><br><br><br>
<?php
$BOOL_cvt01 = imagepalettetotruecolor($id_src01);
if($BOOL_cvt01)
{
imagejpeg($id_src01, $tgt_img01);
}
$id_tgt01 = imagecreatefromjpeg($tgt_img01);
$nbr_colors_tgt01 = imagecolorstotal($id_tgt01);
$get_info_tgt01 = getimagesize($tgt_img01);
$mime_type_tgt01 = $get_info_tgt01["mime"];
echo $tgt_img01 . '<br><br>TRUECOLOR IMAGE' . '( ' .
$mime_type_tgt01 . ' )<br>' .
$nbr_colors_tgt01 . ' colors'; ?>
<br><br><img src="<?php echo $tgt_img01; ?>"
alt="<?php echo $tgt_img01; ?>" width="400">