+

PHP Gmagick setimagerenderingintent () Function

Syntax:
Gmagick Gmagick::setimagerenderingintent ($rend_intent)
Parameters: This function takes one parameter, $rend_intent, which specifies the intent to render the image.Return Value:This function returns a Gmagick object on success. Below programs illustrate the Gmagick::setimagerenderingintent()function in PHP:Program 1:
Source image:
 
// Create a new Gmagick object $im = new Gmagick ( ` https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-15.png ` );  
// Using the getImageRenderingIntent function $res = $im -> getImageRenderingIntent(); echo "Before:" . $res . "< / br >" ;  
// setimagerenderingintent function $im -> setimagerenderingintent (17);  
// using the getImageRenderingIntent function $res = $im -> getImageRenderingIntent();  
// Show result echo "After:" . $res ; ?>
Output:
Before: 2 After: 17
Program 2:
Original image:
$string = "Computer Science portal for Geeks!" ;  
// create a new image above the line // and add color $im = new Gmagick(); $draw = new GmagickDraw();  
// Fill the color in the image $draw -> setFillColor ( new GmagickPixel ( `green` ));  
// Set the text font size $draw -> setFontSize (50); $metrix = $im -> queryFontMetrics ( $draw , $string ); $draw -> annotation (0, 40, $string ); $im -> newImage ( $metrix [ `textWidth` ], $metrix [ `textHeight` ], new GmagickPixel ( `white` )); // Draw image $im -> drawImage ( $draw ); $im -> setImageFormat ( `jpeg` );  
// using the getImageRenderingIntent function $res = $im -> getImageRenderingIntent(); echo "Before:" . $res . "< / br >" ;  
// setimagerenderingintent function $im -> setimagerenderingintent (10);  
// using the getImageRenderingIntent function $res = $im -> getImageRenderingIntent();  
// Show result echo "After:" . $res ; ?>
Output:
Before: 2 After: 10
Link: http: //php.net/manual/en/gmagick.setimagerenderingintent.php
Get Solution for free from DataCamp guru