PHP 8.5.0 RC 2 available for testing

Gmagick::trimimage

(PECL gmagick >= Unknown)

Gmagick::trimimageRemove edges from the image

Beschreibung

public Gmagick::trimimage(float $fuzz): Gmagick

Remove edges that are the background color from the image.

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

The Gmagick object.

Fehler/Exceptions

Wirft bei einem Fehler eine GmagickException.

add a note

User Contributed Notes 1 note

up
0
Anonymous
7 hours ago
To trim image with 15% of fuzziness

<?php

$image
= new Gmagick($image_path);
$max_quantum = 65535;
switch (
$image->getQuantumDepth()['quantumDepthLong']) {
case
8: $max_quantum = 255; break;
case
16: $max_quantum = 65535; break;
case
32: $max_quantum = 4294967295; break;
}
$image->trimImage(0.15 * $max_quantum);
To Top