PHP | Imagick getImageProfile() Function
Last Updated :
26 Nov, 2019
The Imagick::getImageProfile() function is an inbuilt function in PHP which is used to return the named image profile.
Syntax:
string Imagick::getImageProfile( string $name )
Parameters: This function accepts a single parameter $name which holds the name of profile.
Return Value: This function returns a string containing the image profile.
Errors/Exceptions: This function throws ImagickException on error.
Below programs illustrate the Imagick::getImageProfile() function in PHP:
Program 1:
<?php
$imagick = new Imagick(
$imagick ->setImageProfile( 'profile_name' , 'profile_data' );
$profile = $imagick ->getImageProfile( 'profile_name' );
echo $profile ;
?>
|
Output:
profile_data
Program 2:
<?php
$imagick = new Imagick(
$imagick ->setImageProfile( 'color' , 'red' );
$imagick ->setImageBackgroundColor( $imagick ->getImageProfile( 'color' ));
$imagick ->setImageAlphaChannel(Imagick::ALPHACHANNEL_SHAPE);
header( "Content-Type: image/png" );
echo $imagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/imagick.getimageprofile.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...