note 108624 added to imagick.colorizeimage

From: Date: Fri, 11 May 2012 13:26:12 +0000
Subject: note 108624 added to imagick.colorizeimage
Groups: php.notes 
Request: Send a blank email to php-notes+get-187942@lists.php.net to get a copy of this message
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; ?> ---- Server IP: 69.147.83.197 Probable Submitter: 201.86.213.205 ---- Manual Page -- http://www.php.net/manual/en/imagick.colorizeimage.php Edit -- https://master.php.net/note/edit/108624 Del: integrated -- https://master.php.net/note/delete/108624/integrated Del: useless -- https://master.php.net/note/delete/108624/useless Del: bad code -- https://master.php.net/note/delete/108624/bad+code Del: spam -- https://master.php.net/note/delete/108624/spam Del: non-english -- https://master.php.net/note/delete/108624/non-english Del: in docs -- https://master.php.net/note/delete/108624/in+docs Del: other reasons-- https://master.php.net/note/delete/108624 Reject -- https://master.php.net/note/reject/108624 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#187942) next »