downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Imagick::combineImages> <Imagick::colorFloodfillImage
[edit] Last updated: Sun, 19 May 2013

view this page in

Imagick::colorizeImage

(PECL imagick 2.0.0)

Imagick::colorizeImageMélange la couleur de remplissage avec l'image

Description

bool Imagick::colorizeImage ( mixed $colorize , mixed $opacity )

Mélange la couleur de remplissage avec l'image.

Liste de paramètres

colorize

L'objet ImagickPixel ou une chaîne contenant la couleur de colorisation

opacity

L'objet ImagickPixel ou un nombre décimal contenant la valeur de l'opacité. 1.0 est totalement opaque, et 0.0 est totalement transparent.

Valeurs de retour

Returns TRUE on success.

Erreurs / Exceptions

Lance une exception ImagickException si une erreur survient.

Historique

Version Description
2.1.0 Maintenant, permet à une chaîne représentant la couleur comme premier argument et un décimal représentant l'opacité comme second paramètre. Les version précédentes ne permettait que l'utilisation d'objet ImagickPixel.



Imagick::combineImages> <Imagick::colorFloodfillImage
[edit] Last updated: Sun, 19 May 2013
 
add a note add a note User Contributed Notes Imagick::colorizeImage - [3 notes]
up
0
php at lfbittencourt dot com
1 year ago
Do you want a color overlay with TRUE opacity control? Try this:

<?php

class YourImagick extends Imagick
{
    public function
colorize($color, $alpha = 1)
    {
       
$draw = new ImagickDraw();

       
$draw->setFillColor($color);

        if (
is_float($alpha)) {
           
$draw->setFillAlpha($alpha);
        }

       
$geometry = $this->getImageGeometry();
       
$width = $geometry['width'];
       
$height = $geometry['height'];

       
$draw->rectangle(0, 0, $width, $height);

       
$this->drawImage($draw);
    }
}

?>

How to use:

<?php

$imagick
= new YourImagick('example.png');

$imagick->colorize('#ffcc00', 0.35);

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

echo
$source;

?>
up
0
talkol at gmail dot com
1 year ago
When you're using an image with an alpha channel (for example a transparent png), a value of 1.0 will return a completely transparent image, but a value of 1 works just fine.
up
0
lsmartinez at gmail dot com
4 years ago
simplest example

<?php
$nombre
= '001-4-0043.jpg';
$img = new Imagick($nombre);
$img->negateImage(false);
//$pixblu = new ImagickPixel('#000040');
$img->colorizeImage('#0000b0',1.0);
header('content-type: image/jpeg');
echo
$img;
?>

 
show source | credits | sitemap | contact | advertising | mirror sites