(PECL imagick 3)
Imagick::setImageArtifact — Set image artifact
$artifact
, string $value
): boolAssociates an artifact with the image. The difference between image properties and image artifacts is that properties are public and artifacts are private. 此方法在Imagick基于ImageMagick 6.5.7以上版本編譯時(shí)可用。
artifact
The name of the artifact
value
The value of the artifact
成功時(shí)返回 true
。
錯(cuò)誤時(shí)拋出 ImagickException。
示例 #1 Imagick::setImageArtifact()
<?php
function setImageArtifact() {
$src1 = new \Imagick(realpath("./images/artifact/source1.png"));
$src2 = new \Imagick(realpath("./images/artifact/source2.png"));
$src2->setImageVirtualPixelMethod(\Imagick::VIRTUALPIXELMETHOD_TRANSPARENT);
$src2->setImageArtifact('compose:args', "1,0,-0.5,0.5");
$src1->compositeImage($src2, Imagick::COMPOSITE_MATHEMATICS, 0, 0);
$src1->setImageFormat('png');
header("Content-Type: image/png");
echo $src1->getImagesBlob();
}
?>