class ImagickKernel (View source)

Methods

void
addKernel(ImagickKernel $imagickKernel)

Attach another kernel to this kernel to allow them to both be applied in a single morphology or filter function. Returns the new combined kernel.

void
addUnityKernel()

Adds a given amount of the 'Unity' Convolution Kernel to the given pre-scaled and normalized Kernel. This in effect adds that amount of the original image into the resulting convolution kernel. The resulting effect is to convert the defined kernels into blended soft-blurs, unsharp kernels or into sharpening kernels.

static ImagickKernel
fromBuiltin(int $kernelType, string $kernelString)

Create a kernel from a builtin in kernel. See https://www.imagemagick.org/Usage/morphology/#kernel for examples.
Currently the 'rotation' symbols are not supported. Example: $diamondKernel = ImagickKernel::fromBuiltIn(\Imagick::KERNEL_DIAMOND, "2");

static ImagickKernel
fromMatrix(array $matrix, array $origin)

Create a kernel from a builtin in kernel. See https://www.imagemagick.org/Usage/morphology/#kernel for examples.
Currently the 'rotation' symbols are not supported. Example: $diamondKernel = ImagickKernel::fromBuiltIn(\Imagick::KERNEL_DIAMOND, "2");

array
getMatrix()

Get the 2d matrix of values used in this kernel. The elements are either float for elements that are used or 'false' if the element should be skipped.

void
scale()

ScaleKernelInfo() scales the given kernel list by the given amount, with or without normalization of the sum of the kernel values (as per given flags).
The exact behaviour of this function depends on the normalization type being used please see https://www.imagemagick.org/api/morphology.php#ScaleKernelInfo for details.
Flag should be one of Imagick::NORMALIZE_KERNEL_VALUE, Imagick::NORMALIZE_KERNEL_CORRELATE, Imagick::NORMALIZE_KERNEL_PERCENT or not set.

void
seperate()

Separates a linked set of kernels and returns an array of ImagickKernels.

Details

void addKernel(ImagickKernel $imagickKernel)

Since: 3.3.0

Attach another kernel to this kernel to allow them to both be applied in a single morphology or filter function. Returns the new combined kernel.

Parameters

ImagickKernel $imagickKernel

Return Value

void

Exceptions

ImagickKernelException

void addUnityKernel()

Since: 3.3.0

Adds a given amount of the 'Unity' Convolution Kernel to the given pre-scaled and normalized Kernel. This in effect adds that amount of the original image into the resulting convolution kernel. The resulting effect is to convert the defined kernels into blended soft-blurs, unsharp kernels or into sharpening kernels.

Return Value

void

Exceptions

ImagickKernelException

static ImagickKernel fromBuiltin(int $kernelType, string $kernelString)

Since: 3.3.0

Create a kernel from a builtin in kernel. See https://www.imagemagick.org/Usage/morphology/#kernel for examples.
Currently the 'rotation' symbols are not supported. Example: $diamondKernel = ImagickKernel::fromBuiltIn(\Imagick::KERNEL_DIAMOND, "2");

Parameters

int $kernelType

The type of kernel to build e.g. \Imagick::KERNEL_DIAMOND

string $kernelString

A string that describes the parameters e.g. "4,2.5"

Return Value

ImagickKernel

static ImagickKernel fromMatrix(array $matrix, array $origin)

Since: 3.3.0

Create a kernel from a builtin in kernel. See https://www.imagemagick.org/Usage/morphology/#kernel for examples.
Currently the 'rotation' symbols are not supported. Example: $diamondKernel = ImagickKernel::fromBuiltIn(\Imagick::KERNEL_DIAMOND, "2");

Parameters

array $matrix

A matrix (i.e. 2d array) of values that define the kernel. Each element should be either a float value, or FALSE if that element shouldn't be used by the kernel.

array $origin

[optional] Which element of the kernel should be used as the origin pixel. e.g. For a 3x3 matrix specifying the origin as [2, 2] would specify that the bottom right element should be the origin pixel.

Return Value

ImagickKernel

Exceptions

ImagickKernelException

See also

https://www.imagemagick.org/Usage/morphology/#kernel

array getMatrix()

Since: 3.3.0

Get the 2d matrix of values used in this kernel. The elements are either float for elements that are used or 'false' if the element should be skipped.

Return Value

array

A matrix (2d array) of the values that represent the kernel.

Exceptions

ImagickKernelException

void scale()

Since: 3.3.0

ScaleKernelInfo() scales the given kernel list by the given amount, with or without normalization of the sum of the kernel values (as per given flags).
The exact behaviour of this function depends on the normalization type being used please see https://www.imagemagick.org/api/morphology.php#ScaleKernelInfo for details.
Flag should be one of Imagick::NORMALIZE_KERNEL_VALUE, Imagick::NORMALIZE_KERNEL_CORRELATE, Imagick::NORMALIZE_KERNEL_PERCENT or not set.

void seperate()

Since: 3.3.0

Separates a linked set of kernels and returns an array of ImagickKernels.

Return Value

void

Exceptions

ImagickKernelException