ImagickKernel::addKernel

(PECL imagick >= 3.3.0)

ImagickKernel::addKernelAttach another kernel to a kernel list

说明

public ImagickKernel::addKernel(ImagickKernel $ImagickKernel): void

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.

参数

ImagickKernel

返回值

示例

示例 #1 ImagickKernel::addKernel()

<?php
function addKernel($imagePath) {
$matrix1 = [
[-
1, -1, -1],
[
0, 0, 0],
[
1, 1, 1],
];

$matrix2 = [
[-
1, 0, 1],
[-
1, 0, 1],
[-
1, 0, 1],
];

$kernel1 = ImagickKernel::fromMatrix($matrix1);
$kernel2 = ImagickKernel::fromMatrix($matrix2);
$kernel1->addKernel($kernel2);

$imagick = new \Imagick(realpath($imagePath));
$imagick->filter($kernel1);
header("Content-Type: image/jpg");
echo
$imagick->getImageBlob();

}

?>

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top