getQuantumRange() can be handy here:
<?php
$i = new Imagick($imageFile);
$max = $i->getQuantumRange();
$max = $max["quantumRangeLong"];
$i->thresholdImage(0.77 * $max);
?>
Imagick::thresholdImage
(PECL imagick 2.0.0)
Imagick::thresholdImage — 閾値にもとづいて個々のピクセルの値を変更する
説明
bool Imagick::thresholdImage
( float
$threshold
[, int $channel = Imagick::CHANNEL_ALL
] )個々のピクセルの輝度を閾値と比較し、その色を変更します。 変換結果は、コントラストの高い 2 色の画像となります。
パラメータ
-
threshold -
-
channel -
返り値
成功した場合に TRUE を返します。
php t traction dot de ¶
11 months ago
