error_reporting(0); include("functions.php"); $h1 = "DJ Mike's Image Maker 2"; $h2 = "Threshold, Black Threshold, White Threshold, Adaptive Threshold"; ######### Adaptive Threshold ######### if ( $_GET[adaptivethreshold] ) { $adaptivethreshold_width = (int)trim($_GET[adaptivethreshold_width] ); $adaptivethreshold_height = (int)trim($_GET[adaptivethreshold_height] ); $adaptivethreshold_offset = (int)trim($_GET[adaptivethreshold_offset] ); $path = $_SESSION[path]; $image = new Imagick($path); foreach ($image as $frame) { $frame->adaptivethresholdImage ( $adaptivethreshold_width, $adaptivethreshold_height, $adaptivethreshold_offset ); } $format = strtolower( $image->getimageformat() ); $path = "temp/$ID.$_SESSION[views].$format"; $_SESSION[path] = $path; $_SESSION[adaptivethreshold_width] = $adaptivethreshold_width; $_SESSION[adaptivethreshold_height] = $adaptivethreshold_height; $_SESSION[adaptivethreshold_offset] = $adaptivethreshold_offset; $frames = $image->getNumberImages(); if ( $frames > 1) { $image->writeImages("$path", TRUE); } else { $image->writeImage("$path"); } # save settings header("location:display.php"); exit; } ######### end Adaptive Threshold ######### ############ Threshold ########### if ( $_GET[threshold] || $_GET[blackthreshold] || $_GET[whitethreshold] ) { ## validate color $threshold_color = trim($_GET[threshold_color] ); $threshold_color = colors( $threshold_color, "validate" ); if ( !$threshold_color ) { $_SESSION[error] = "Color is invalid"; header("location:$self"); exit; } ## end validate $image = new Imagick($_SESSION[path]); if ( $_GET[blackthreshold] || $_GET[threshold] ) { foreach ($image as $frame) { $frame->blackthresholdImage( $threshold_color ); } } if ( $_GET[whitethreshold] || $_GET[threshold] ) { foreach ($image as $frame) { $frame->whitethresholdImage( $threshold_color ); } } $format = strtolower( $image->getimageformat() ); $path = "temp/$ID.$_SESSION[views].$format"; $_SESSION[path] = $path; $_SESSION[threshold_color] = $threshold_color; $frames = $image->getNumberImages(); if ( $frames > 1) { $image->writeImages("$path", TRUE); } else { $image->writeImage("$path"); } # save settings header("location:display.php"); exit; header("Location: display.php"); exit; } ################ End Threshold ########### include("top.php"); ?>
Enter a threshold color. Color can be a named color or hex. Examples: red, #0000ff