$h1 = "DJ Mike's Image Maker 2"; $h2 = "Reduce Colors"; include("functions.php"); if ( $_GET[num_colors] ) { $path = $_SESSION[path]; $num_colors = (int)$_GET[num_colors]; # create image object $image = new Imagick("$path"); foreach ($image as $frame) { # reduce colors $frame->quantizeImage($num_colors, imagick::COLORSPACE_TRANSPARENT, 5, TRUE, TRUE); } $format = strtolower( $image->getimageformat() ); $path = "temp/$ID.$_SESSION[views].$format"; $_SESSION[path] = $path; $frames = $image->getNumberImages(); if ( $frames > 1) { # write animation $image->writeImages("$path", TRUE); } else { # write single $image->writeImage("$path"); } header("location:display.php"); exit; } include("top.php"); ?>
Enter the number of colors that you want the image to have. Works on GIF's and PNG's
include("footer.php"); ?>