PHP - Manual: Imagick::shadeImage
2024-12-22
(PECL imagick 2, PECL imagick 3)
Imagick::shadeImage — Creates a 3D effect
$gray
, float $azimuth
, float $elevation
): boolShines a distant light on an image to create a three-dimensional effect. You control the positioning of the light with azimuth and elevation; azimuth is measured in degrees off the x axis and elevation is measured in pixels above the Z axis. 此方法在Imagick基于ImageMagick 6.2.9以上版本编译时可用。
gray
A value other than zero shades the intensity of each pixel.
azimuth
Defines the light source direction.
elevation
Defines the light source direction.
成功时返回 true
。
Throws ImagickException on failure.
示例 #1 Imagick::shadeImage()
<?php
function shadeImage($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->shadeImage(true, 45, 20);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>