<?php
bool public Imagick::thresholdImage(
float $threshold,
int $channel = Imagick::CHANNEL_DEFAULT);
?>
AVAILABLE "imagick" CHANNEL STUDIED IN THIS TUTORIAL 1690 - ImageMagick 6.9.10-6 | ||
CHANNEL | ||
CONSTANT | VALUE | ABOUT |
imagick::CHANNEL_UNDEFINED | 0 | |
imagick::CHANNEL_RED | 1 | |
imagick::CHANNEL_GRAY | 1 | |
imagick::CHANNEL_CYAN | 1 | |
imagick::CHANNEL_GREEN | 2 | |
imagick::CHANNEL_MAGENTA | 2 | |
imagick::CHANNEL_BLUE | 4 | |
imagick::CHANNEL_YELLOW | 4 | |
imagick::CHANNEL_ALPHA | 8 | |
imagick::CHANNEL_OPACITY | 8 | |
imagick::CHANNEL_MATTE | 8 | |
imagick::CHANNEL_BLACK | 32 | |
imagick::CHANNEL_INDEX | 32 | |
imagick::CHANNEL_ALL | 134217727 | |
imagick::CHANNEL_DEFAULT | 134217719 | |
ed48 |
RANDOMIZED COLOR Each new run, a new color is shown. | |||
rgb code | hexadecimal | color | THRESHOLD |
71, 53, 10 | #47350a | Threshold = 0.24 Quantum = 65535 Channel = 134217719 | |
ed48 |
<?php
// Run several times
$file1 = PATH2IMGW . '/gif/E 01 01.gif';
$str1img = 'img/results/E 01 01th661.gif';
$image1 = new Imagick($file1);
$threshold = mt_rand(0, 100) / 100;
$quantum = $image1->getQuantum();
$channel = imagick::CHANNEL_DEFAULT;
$image1->thresholdImage($threshold * $quantum, $channel);
$image1 = $image1->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; ?>">