我想将此 ImageMagick 命令转换为 PHP 代码:
convert text.jpg \( +clone -blur 0x3 \) +swap -compose divide -composite -resize 1000% -morphology open diamond:1 -resize 10% x2.png
这里是我的代码:
$input = new Imagick(__DIR__ . self::CACHE_PATH . 'data_' . $filename);
// Create a clone and apply a blur
$clone = clone $input;
$clone->blurImage(0, 3);
// Combine the original image and the blurred clone using the "divide" compose method
$input->compositeImage($clone, 65, 0, 0);
// Resize the image to 1000%
$input->scaleImage($input->getImageWidth() * 10, $input->getImageHeight() * 10);
// Create a diamond-shaped kernel of size 1
$kernel = \ImagickKernel::fromBuiltIn(\Imagick::KERNEL_DIAMOND, '1');
// Apply an open morphology with the diamond kernel
$input->morphology(\Imagick::MORPHOLOGY_OPEN, 1, $kernel, \Imagick::CHANNEL_ALPHA);
// Resize the image to 10%
$input->scaleImage($input->getImageWidth() / 10, $input->getImageHeight() / 10);
// Write the output image
$input->writeImage(__DIR__ . self::CACHE_PATH . 'fix_data_' . $filename);
请帮忙,我在哪里可以找到其他命令?我的代码返回模糊图像。但我需要正常图像