PHP | Imagick roundCorners() Function
The Imagick::roundCorners() function is an inbuilt function in PHP which is used to round the image corners.
Syntax:
bool Imagick::roundCorners( float $x_rounding,
float $y_rounding, float $stroke_width = 10,
float $displace = 5, float $size_correction = -6 )
Parameters: This function accepts five parameters as mentioned above and described below:
- $x_rounding: It specifies the amount of x rounding.
- $y_rounding: It specifies the amount of y rounding.
- $stroke_width (Optional): It specifies the stroke width. Default value of this parameter is 10.
- $displace (Optional): It specifies the image displace. Default value of this parameter is 5.
- $size_correction (Optional): It specifies the size correction. Default value of this parameter is -6.
Return Value: This function returns TRUE on success.
Exceptions: This function throws ImagickException on error.
Below given programs illustrate the Imagick::roundCorners() function in PHP:
Program 1:
<?php
$imagick = new Imagick(
$imagick ->roundCorners(20, 20, 5, 5, -8);
$imagick ->setImageFormat( 'jpg' );
header( "Content-Type: image/jpg" );
echo $imagick ->getImageBlob();
?>
|
Output:
Program 2:
<?php
$imagick = new Imagick(
$imagick ->roundCorners(100, 100, 5);
$imagick ->setImageFormat( 'jpg' );
header( "Content-Type: image/jpg" );
echo $imagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/imagick.roundcorners.php
Last Updated :
05 Dec, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...