PHP | Gmagick setimagebordercolor() Function
Last Updated :
14 Jan, 2020
The Gmagick::setimagebordercolor() function is an inbuilt function in PHP which is used to set the image border color to be applied.
Syntax:
Gmagick Gmagick::setimagebordercolor( GmagickPixel $color )
Parameters: This function accepts a single parameter $color which holds the color.
Return Value: This function returns a Gmagick object on success.
Exceptions: This function throws GmagickException on error.
Below given programs illustrate the Gmagick::setimagebordercolor() function in PHP:
Used Image:
Program 1:
<?php
$gmagick = new Gmagick( 'geeksforgeeks.png' );
$gmagick ->setimagebordercolor( '#ba5959' );
$color = $gmagick ->getimagebordercolor();
print ( "<pre>" . print_r( $color ->getcolor(), true) . "</pre>" );
?>
|
Output:
rgb(47802, 22873, 22873)
Program 2:
<?php
$gmagick = new Gmagick( 'geeksforgeeks.png' );
$gmagick ->setimagebordercolor( 'red' );
$gmagick ->borderimage( $gmagick ->getimagebordercolor(), 10, 10);
header( "Content-Type: image/jpg" );
echo $gmagick ;
?>
|
Output:
Reference: https://www.php.net/manual/en/gmagick.setimagebordercolor.php
Share your thoughts in the comments
Please Login to comment...