PHP | Gmagick setimagerenderingintent() Function
Last Updated :
31 Jan, 2022
The Gmagick::setimagerenderingintent() function is an inbuilt function in PHP which is used to set the image rendering intent.
Syntax:
Gmagick Gmagick::setimagerenderingintent( $rend_intent )
Parameters: This function accepts a single parameter $rend_intent which specifies the rendering intent of image.
Return Value: This function returns Gmagick object on success.
Below programs illustrate the Gmagick::setimagerenderingintent() function in PHP:
Program 1:
Original Image:
php
<?php
$im = new Gmagick(
$res = $im ->getImageRenderingIntent();
echo "Before: " . $res ."</br>";
$im ->setimagerenderingintent(17);
$res = $im ->getImageRenderingIntent();
echo "After: " . $res ;
?>
|
Output:
Before: 2
After: 17
Program 2:
Original Image:
php
<?php
$string = "Computer Science portal for Geeks!";
$im = new Gmagick();
$draw = new GmagickDraw();
$draw ->setFillColor( new GmagickPixel( 'green' ));
$draw ->setFontSize(50);
$matrix = $im ->queryFontMetrics( $draw , $string );
$draw ->annotation(0, 40, $string );
$im ->newImage( $matrix [ 'textWidth' ], $matrix [ 'textHeight' ],
new GmagickPixel( 'white' ));
$im ->drawImage( $draw );
$im ->setImageFormat( 'jpeg' );
$res = $im ->getImageRenderingIntent();
echo "Before: " . $res ."</br>";
$im ->setimagerenderingintent(10);
$res = $im ->getImageRenderingIntent();
echo "After: " . $res ;
?>
|
Output:
Before: 2
After: 10
Reference: http://php.net/manual/en/gmagick.setimagerenderingintent.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...