array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'imagick.trimimage.php', 1 => 'Imagick::trimImage', 2 => 'Remove edges from the image', ), 'up' => array ( 0 => 'class.imagick.php', 1 => 'Imagick', ), 'prev' => array ( 0 => 'imagick.transverseimage.php', 1 => 'Imagick::transverseImage', ), 'next' => array ( 0 => 'imagick.uniqueimagecolors.php', 1 => 'Imagick::uniqueImageColors', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/imagick/imagick/trimimage.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

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;
?>

Прогляньте також