(PECL imagick 3 >= 3.3.0)
Imagick::brightnessContrastImage — 更改图像的亮度和/或对比度
$brightness
, float $contrast
, int $channel
= Imagick::CHANNEL_DEFAULT): bool更改图像的亮度和/或对比度。它将亮度和对比度参数转换为斜率和截距,并调用多项式函数应用于图像。
brightness
contrast
channel
成功时返回 true
。
示例 #1 Imagick::brightnessContrastImage()
<?php
function brightnessContrastImage($imagePath, $brightness, $contrast, $channel) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->brightnessContrastImage($brightness, $contrast, $channel);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>