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: Fri, 17 May 2013

view this page in

Imagick::colorizeImage

(PECL imagick 2.0.0)

Imagick::colorizeImageBlends the fill color with the image

Descrierea

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

Blends the fill color with each pixel in the image.

Parametri

colorize

ImagickPixel object or a string containing the colorize color

opacity

ImagickPixel object or an float containing the opacity value. 1.0 is fully opaque and 0.0 is fully transparent.

Valorile întoarse

Întoarce TRUE în caz de succes.

Erori/Excepții

Emite ImagickException în caz de eroare.

Istoria schimbărilor

Versiunea Descriere
2.1.0 Now allows a string representing the color as the first parameter and a float representing the opacity value as the second parameter. Previous versions allow only an ImagickPixel objects.



Imagick::combineImages> <Imagick::colorFloodfillImage
[edit] Last updated: Fri, 17 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 | stats | sitemap | contact | advertising | mirror sites