You need to pass this function a colour:
<?php
$img->blackThresholdImage( "#FFFFFF" );
?>
E.g. this blackens any pixel which isn't pure white.(PECL imagick 2, PECL imagick 3)
Imagick::blackThresholdImage — Força todos os pixels abaixo do limite para preto
É como Imagick::thresholdImage() mas força todos os pixels abaixo do limite para preto, deixando todos os pixels acima do limite inalterados.
thresholdO limite abaixo do qual tudo fica preto
Retorna true em caso de sucesso.
| Versão | Descrição |
|---|---|
| PECL imagick 2.1.0 | Agora permite uma string representando a cor como parâmetro. As versões anteriores permitiam apenas um objeto ImagickPixel. |
Exemplo #1 Exemplo de Imagick::blackThresholdImage()
<?php
function blackThresholdImage($imagePath, $thresholdColor) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->blackthresholdimage($thresholdColor);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>You need to pass this function a colour:
<?php
$img->blackThresholdImage( "#FFFFFF" );
?>
E.g. this blackens any pixel which isn't pure white.Here's a example of this function:
<?php
$img = new Imagick();
$img->readImage($image_file_name);
$img->blackThresholdImage('grey');
$img->writeImage($thumb_file_name);
$img->clear();
$img->destroy();
?>