Imagick::filter

(PECL imagick 3 >= 3.3.0)

Imagick::filterApplies a custom convolution kernel to the image

Advertencia

This function has been DEPRECATED as of Imagick 3.4.4. Relying on this function is highly discouraged.

Descripción

publicImagick::filter(ImagickKernel$ImagickKernel, int$channel = Imagick::CHANNEL_UNDEFINED): bool

Applies a custom convolution kernel to the image.

Parámetros

ImagickKernel

An instance of ImagickKernel that represents either a single kernel or a linked series of kernels.

channel

Proporciona cualquier contante de canal que sea válida para su modo de canal. Para aplicarlo a más de un canal, combine constantes de canal using bitwise operadores bit a bit. El valor por defecto para Imagick::CHANNEL_DEFAULT. Referirse a esta lista de constantes de canal

Valores devueltos

Devuelve true en caso de éxito.

Ejemplos

Ejemplo #1 Imagick::filter()

<?php
function filter($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$matrix = [
[-
1, 0, -1],
[
0, 5, 0],
[-
1, 0, -1],
];

$kernel = \ImagickKernel::fromMatrix($matrix);
$strength = 0.5;
$kernel->scale($strength, \Imagick::NORMALIZE_KERNEL_VALUE);
$kernel->addUnityKernel(1 - $strength);

$imagick->filter($kernel);
header("Content-Type: image/jpg");
echo
$imagick->getImageBlob();
}

?>
To Top