note 124141 added to imagick.roundcorners
| From: | ar2rsoft at gmail dot com | Date: | Mon, 26 Aug 2019 10:05:08 +0000 |
| Subject: | note 124141 added to imagick.roundcorners | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-212020@lists.php.net to get a copy of this message | ||
Alternative solution:
// example values
$width = 250;
$height = 250;
$cornerRadius = 10;
// create mask image
$mask = new Imagick();
$mask->newImage($width, $height, new ImagickPixel('transparent'), 'png');
// create the rounded rectangle
$shape = new ImagickDraw();
$shape->setFillColor(new ImagickPixel('black'));
$shape->roundRectangle(0, 0, $width, $height, $cornerRadius, $cornerRadius);
// draw the rectangle
$mask->drawImage($shape);
// apply mask
$image->compositeImage($mask, Imagick::COMPOSITE_DSTIN, 0, 0);
I found solution here:
https://github.com/Imagick/imagick/issues/213#issuecomment-385928740
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.195 (proxied: 178.254.171.103)
----
Manual Page -- http://php.net/manual/en/imagick.roundcorners.php
Edit -- https://master.php.net/note/edit/124141
Del: integrated -- https://master.php.net/note/delete/124141/integrated
Del: useless -- https://master.php.net/note/delete/124141/useless
Del: bad code -- https://master.php.net/note/delete/124141/bad+code
Del: spam -- https://master.php.net/note/delete/124141/spam
Del: non-english -- https://master.php.net/note/delete/124141/non-english
Del: in docs -- https://master.php.net/note/delete/124141/in+docs
Del: other reasons-- https://master.php.net/note/delete/124141
Reject -- https://master.php.net/note/reject/124141
Search -- https://master.php.net/manage/user-notes.php