Imagick::thresholdImage

閾値にもとづいて個々のピクセルの値を変更する

説明

public bool Imagick::thresholdImage(float $threshold, int $channel = Imagick::CHANNEL_DEFAULT)

個々のピクセルの輝度を閾値と比較し、その色を変更します。 変換結果は、コントラストの高い 2 色の画像となります。

パラメータ

threshold

channel

戻り値

成功した場合に true を返します。

例1 Imagick::thresholdImage

<?php
function thresholdimage($imagePath$threshold$channel) {
    
$imagick = new \Imagick(realpath($imagePath));
    
$imagick->thresholdimage($threshold \Imagick::getQuantum(), $channel);
    
header("Content-Type: image/jpg");
    echo 
$imagick->getImageBlob();
}

?>