Skip to content

Instantly share code, notes, and snippets.

@rxaviers
Last active December 10, 2015 23:49
Show Gist options
  • Save rxaviers/4512462 to your computer and use it in GitHub Desktop.
Save rxaviers/4512462 to your computer and use it in GitHub Desktop.
<?
function ReduceColorDepth(&$gdimg, $colors=256, $dither=true) {
$colors = max(min($colors, 256), 2);
// ImageTrueColorToPalette usually makes ugly colors, the replacement is a bit better
//ImageTrueColorToPalette($gdimg, $dither, $colors);
phpthumb_filters::ImageTrueColorToPalette2($gdimg, $dither, $colors);
return true;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment