PHP | ImagickDraw setClipUnits() Function Last Updated : 23 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 of RESOLUTION constants. List of RESOLUTION constants are given below: imagick::RESOLUTION_UNDEFINED (0) imagick::RESOLUTION_PIXELSPERINCH (1) imagick::RESOLUTION_PIXELSPERCENTIMETER (2) Return Value: This function returns TRUE on success. Exceptions: This function throws ImagickException on error. Below given programs illustrate the ImagickDraw::setClipUnits() function in PHP: Program 1: php <?php // Create a new ImagickDraw object $draw = new ImagickDraw(); // Set clipUnits $draw->setClipUnits(imagick::RESOLUTION_PIXELSPERCENTIMETER); // Get clipUnits echo $draw->getClipUnits(); ?> Output: 2 // which corresponds to one of imagick::RESOLUTION_PIXELSPERCENTIMETER. Program 2: php <?php // Create a new imagick object $imagick = new Imagick(); // Create a image on imagick object $imagick->newImage(500, 250, 'green'); // Create a new ImagickDraw object $draw = new ImagickDraw(); $draw->setClipUnits(imagick::RESOLUTION_PIXELSPERINCH); $draw->setFontSize(24); $draw->annotation(160, 125, 'The clipUnits is ' . $draw->getClipUnits() . '.'); // 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.setclipunits.php Comment More infoAdvertise with us Next Article PHP | Imagick setImageUnits() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | ImagickDraw setClipPath() Function 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: 2 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 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 PHP | Imagick setImageUnits() Function The Imagick::setImageUnits() function is an inbuilt function in PHP which is used to set the units of resolution of a particular image.Syntax:  bool Imagick::setImageUnits( $units ) Parameters: This function accepts single parameter $units which is used to specify the units to be set for image. Res 2 min read PHP | ImagickDraw setFontSize() Function The ImagickDraw::setFontSize() function is an inbuilt function in PHP which is used to set the font point size. It is used when annotating with text. Syntax:  bool ImagickDraw::setFontSize( $pointsize ) Parameters: This function accepts a single parameter $pointsize which is used to hold the value 2 min read 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 Like