PHP | ImagickDraw setClipPath() Function Last Updated : 23 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The ImagickDraw::setClipPath() function is an inbuilt function in PHP which is used to associate a named clipping path with the image. Only the areas drawn on by the clipping path will be modified as long as it remains in effect. Syntax: bool ImagickDraw::setClipPath( string $clip_mask ) Parameters: This function accepts a single parameter $clip_mask which holds the clip mask. Return Value: This function returns TRUE on success. Exceptions: This function throws ImagickException on error. Below given programs illustrate the ImagickDraw::setClipPath() function in PHP: Program 1: php <?php // Create a new ImagickDraw object $draw = new ImagickDraw(); // Set the clipPath $draw->setClipPath('nameOfClipPath'); // Get clip path echo $draw->getClipPath(); ?> Output: nameOfClipPath Program 2: php <?php // Create a new imagick object $imagick = new Imagick(); // Create a image on imagick object $imagick->newImage(800, 250, 'green'); // Create a new ImagickDraw object $draw = new ImagickDraw(); // Setup a clipPath $draw->pushClipPath('myClipPath'); $draw->rectangle(100, 40, 200, 200); $draw->popClipPath(); $draw->setClipPath('myClipPath'); // Extra commands which are going to // be ignore as they are outside the // area of the clipPath $draw->rectangle(10, 100, 400, 400); $draw->line(100, 100, 400, 400); // Render the draw commands $imagick->drawImage($draw); // Show the output $imagick->setImageFormat('png'); header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/imagickdraw.setclippath.php Comment More infoAdvertise with us Next Article PHP | ImagickDraw popClipPath() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | ImagickDraw pushClipPath() Function The ImagickDraw::pushClipPath() function is an inbuilt function in PHP which is used to starts a clip-path definition. Clip paths are used to creates a clipping region that decides which part of an image should be shown. Parts that are inside the region are shown, while those outside are hidden. Syn 2 min read PHP | ImagickDraw popClipPath() Function The ImagickDraw::popClipPath() function is an inbuilt function in PHP which is used to terminate a clip-path definition. Clip paths are used to creates a clipping region that decides which part of an image should be shown. Parts that are inside the region are shown, while those outside are hidden. S 2 min read PHP | ImagickDraw setClipUnits() Function The ImagickDraw::setClipUnits() function is an inbuilt function in PHP which is used to set the interpretation of clip path units. Syntax: bool ImagickDraw::setClipUnits( int $clip_units ) Parameters: This function accept a single parameter $clip_units which is an integer value corresponding to one 1 min read PHP | ImagickDraw setClipRule() Function The ImagickDraw::setClipRule() function is an inbuilt function in PHP which is used to set the polygon fill rule to be used by the clipping path. This usually doesn't have any impact on the final image but still provides different FILLRULE methods to complete the same task. Syntax: bool ImagickDraw: 2 min read PHP | ImagickDraw setFillOpacity() Function The ImagickDraw::setFillOpacity() function is an inbuilt function in PHP which is used to set the opacity to use when drawing using the fill color or fill texture.Syntax:Â bool ImagickDraw::setFillOpacity( $fillOpacity ) Parameters: This function accepts a single parameter $fillOpacity which is used 2 min read PHP | ImagickDraw setFont() Function The ImagickDraw::setFont() function is an inbuilt function in PHP which is used to set the fully-specified font to use when annotating with text. Syntax: bool ImagickDraw::setFont( $font_name ) Parameters: This function accepts a single parameter $font_name which is used to hold the value of font na 2 min read Like