Imagick::blackThresholdImage


wizard apg

FORCES all pixels of images below the threshold into black.



<?php

bool 
public Imagick::blackThresholdImage(mixed $threshold);
                                            
?>

$threshold


The threshold below which everything turns black.





This function returns true on success.



  1 EXERCISE   

<?php

// Run several times

$path1 PATH2IMGW '/jpg/3.jpg';

$str1img 'img/results/3bth671.gif';

$im1 = new Imagick($path1);

$r mt_rand(16255);
$g mt_rand(16255);
$b mt_rand(16255);

$rr dechex($r);
$gg dechex($g);
$bb dechex($b);

$thresholdColor '#'"$rr$gg$bb";

$im1->blackthresholdimage($thresholdColor);

$image1 $im1->getImageBlob();

$img imagecreatefromstring($image1);

imagegif($img$str1img);

echo 
basename($str1img); ?>
<br><br>
<img src="<?php echo $str1img?>"
 alt="<?php echo $str1img?>
 title="<?php echo $str1img?>">

 RESULT   

$thresholdColor = (#72449a)

blackthresholdimage(#72449a)


3bth671.gif

img/results/3bth671.gif apr