哈希空间 Ctrl + F 进行搜索
首页 php手册中文版 CSS中文手册 哈希文档 Markdown在线工具

Imagick::trimImage

(PECL imagick 2, PECL imagick 3)

Imagick::trimImageRemove edges from the image

说明

public Imagick::trimImage(float $fuzz): bool

Remove edges that are the background color from the image. 此方法在Imagick基于ImageMagick 6.2.9以上版本编译时可用。

参数

fuzz

By default target must match a particular pixel color exactly. However, in many cases two colors may differ by a small amount. The fuzz member of image defines how much tolerance is acceptable to consider two colors as the same. This parameter represents the variation on the quantum range.

返回值

成功时返回 true

错误/异常

错误时抛出 ImagickException。

范例

示例 #1 Using Imagick::trimImage():

Trim an image, then display to the browser.

<?php
/* Create the object and read the image in */
$im = new Imagick("image.jpg");

/* Trim the image. */
$im->trimImage(0);

/* Ouput the image */
header("Content-Type: image/" $im->getImageFormat());
echo 
$im;
?>

参见

打开 哈希空间 微信小程序中查看更佳