PHP Doku:: Remove edges from the image - function.imagick-trimimage.html

Verlauf / Chronik / History: (4) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzBildverarbeitung und -generierungImage Processing (ImageMagick)The Imagick classImagick::trimImage

Ein Service von Reinhard Neidl - Webprogrammierung.

The Imagick class

<<Imagick::transverseImage

Imagick::uniqueImageColors>>

Imagick::trimImage

(PECL imagick 2.0.0)

Imagick::trimImageRemove edges from the image

Beschreibung

bool Imagick::trimImage ( float $fuzz )

Remove edges that are the background color from the image. Diese Funktion ist verfügbar, wenn Imagick gegen die ImageMagick-Version 6.2.9 oder höher kompiliert wurde.

Parameter-Liste

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.

Rückgabewerte

Liefert TRUE bei Erfolg.

Fehler/Exceptions

Wirft ImagickException bei Fehlern.

Beispiele

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

Siehe auch


2 BenutzerBeiträge:
- Beiträge aktualisieren...
dhp
23.04.2009 13:31
After operations that change the crop of the image, like trimImage does, IM preserves the old canvas and positioning info. If you need to do additional operations on the image based on the new size, you'll need to reset this info with setImagePage. This is the equivalent of the +repage command line argument.

<?php
$im
->trimImage(0);
$im->setImagePage(0, 0, 0, 0);
?>
Mark van der Velden
6.12.2007 10:35
This method requires ImageMagick version >= 6.2.8



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)