PHP Conference Japan 2024

Imagick::getImageRegion

(PECL imagick 2, PECL imagick 3)

Imagick::getImageRegion提取影像的區域

描述

public Imagick::getImageRegion(
    int $width,
    int $height,
    int $x,
    int $y
): Imagick

提取影像的區域,並將其作為新的 Imagick 物件傳回。

參數

width

提取區域的寬度。

height

提取區域的高度。

x

提取區域左上角的 X 座標。

y

提取區域左上角的 Y 座標。

傳回值

提取影像的區域,並將其作為新的魔杖傳回。

錯誤/例外

發生錯誤時拋出 ImagickException。

新增筆記

使用者貢獻的筆記 1 筆筆記

6
zolcos at hotmail dot com
15 年前
getImageRegion 具有與變更影像裁剪的操作相同的副作用 -- 新影像保留舊的畫布和定位資訊。例如,在新影像上使用 annotateImage 將會根據舊影像解釋定位引數。若要修正此問題,請使用 setImagePage 重設此資訊。

<?php
$im
->setImagePage(0, 0, 0, 0);
?>
To Top