PHP | Imagick setImageRenderingIntent() Function
The Imagick::setImageRenderingIntent() function is an inbuilt function in PHP which is used to sets the image rendering intent.
Syntax:
bool Imagick::setImageRenderingIntent( $rend_intent )
Parameters: This function accepts single parameter $rend_intent which specifies the rendering intent of image.
Return Value: This function returns True on success.
Below programs illustrate the Imagick::setImageRenderingIntent() function in PHP:
Original Image:
Program 1:
<?php
$im = new Imagick(
$res = $im ->getImageRenderingIntent();
echo "Before: " . $res . "</br>" ;
$im ->setImageRenderingIntent(17);
$res = $im ->getImageRenderingIntent();
echo "After: " . $res ;
?>
|
Output:
Before: 2
After: 17
Original Image:
Program 2:
<?php
$string = "Computer Science portal for Geeks!" ;
$im = new Imagick();
$draw = new ImagickDraw();
$draw ->setFillColor( new ImagickPixel( 'green' ));
$draw ->setFontSize(50);
$metrix = $im ->queryFontMetrics( $draw , $string );
$draw ->annotation(0, 40, $string );
$im ->newImage( $metrix [ 'textWidth' ], $metrix [ 'textHeight' ],
new ImagickPixel( '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/imagick.setimagerenderingintent.php
Last Updated :
26 Aug, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...