PHP Conference Japan 2024

Imagick::statisticImage

(PECL imagick 3 >= 3.3.0)

Imagick::statisticImage使用統計函式修改影像

說明

public Imagick::statisticImage(
    int $type,
    int $width,
    int $height,
    int $channel = Imagick::CHANNEL_DEFAULT
): bool

將每個像素替換為指定寬度和高度的鄰域中的對應統計值。

參數

type

width

height

channel

傳回值

成功時傳回 true

範例

範例 #1 Imagick::statisticImage()

<?php
function statisticImage($imagePath, $statisticType, $width, $height, $channel) {
$imagick = new \Imagick(realpath($imagePath));

$imagick->statisticImage(
$statisticType,
$width,
$height,
$channel
);

header("Content-Type: image/jpg");
echo
$imagick->getImageBlob();
}

statisticImage($imagePath, \Imagick::STATISTIC_MEDIAN, 5, 5, \Imagick::CHANNEL_DEFAULT);

?>

新增註解

使用者貢獻註解

此頁面沒有使用者貢獻註解。
To Top