Imagick::recolorImage

(PECL imagick 2 >= 2.3.0, PECL imagick 3)

Imagick::recolorImageRecolors image

Avertizare

Această funcție este ÎNVECHITĂ începând cu Imagick 3.4.4. Utilizarea acesteia este foarte nerecomandată.

Descrierea

public Imagick::recolorImage ( array $matrix ) : bool

Translate, scale, shear, or rotate image colors. This method supports variable sized matrices but normally 5x5 matrix is used for RGBA and 6x6 is used for CMYK. The last row should contain the normalized values. Această metodă este disponibilă dacă Imagick a fost compilat cu ImageMagick de versiunea 6.3.6 sau ulterior.

Parametri

matrix

The matrix containing the color values

Valorile întoarse

Întoarce true în caz de succes.

A se vedea și

Exemple

Example #1 Imagick::recolorImage()

<?php
function recolorImage($imagePath) {
    
$imagick = new \Imagick(realpath($imagePath));
    
$remapColor = [ 100,
        
001,
        
010,];

//$remapColor = [
//    1.438, -0.122, -0.016,  0, 0, -0.03,
//    -0.062,  1.378, -0.016,  0, 0,  0.05,
//    -0.062, -0.122, 1.483,   0, 0, -0.02,
//];

    
@$imagick->recolorImage($remapColor);

    
header("Content-Type: image/jpg");
    echo 
$imagick->getImageBlob();
}

?>

add a note add a note

User Contributed Notes 1 note

up
1
softmixt at gmail dot com
10 years ago
Simple example :

<?php

$image
= new Imagick('test.jpg');

$CMYK_color_model = array(0,100,0,0);

$image->recolorImage($CMYK_color_model) ;

header('Content-type: image/jpg');

echo
$image
?>
To Top