PHP | Imagick profileImage() Function
The Imagick::profileImage() function is an inbuilt function in PHP which is used to add or remove profile from an image. If the profile is NULL, it is removed from the image otherwise added.
About ICC image profiles: In color management, an ICC profile is a set of data that characterizes a color input or output device, or a color space, according to standards promulgated by the International Color Consortium (ICC). Color space means a specific organization of colors.
Syntax:
bool Imagick::profileImage( $name, $profile )
Parameters: This function accepts two parameters as mentioned above and described below:
- $name: This parameter holds the name of profile of an image.
- $profile: This parameter holds the content of the profile file.
Return Value: This function returns true on success.
Below program illustrates the Imagick::profileImage() function in PHP:
Program:
php
<?php
$image = new Imagick(
$profiles = $image ->getImageProfiles( '*' , false);
$has_icc_profile = ( array_search ( 'icc' , $profiles ) !== false);
if ( $has_icc_profile === false) {
$icc = file_get_contents ( 'D:\\Merawamp\\www\\New\\to\\icc\\CMYK.icc' );
$trip1 = $image ->profileImage( 'icc' , $icc );
}
if ( $trip1 == true) {
echo "Profile added to image successfully" ;
}
?>
|
Output:
Last Updated :
21 Oct, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...