PHP | Imagick removeImageProfile() Function

The Imagick::removeImageProfile() function is an inbuilt function in PHP which is used to remove the named image profile.

Syntax:

string Imagick::removeImageProfile( string $name )

Parameters: This function accepts a single parameter $name which holds the name of the profile.

Return Value: This function returns a string containing the profile.

Exceptions: This function throws ImagickException on error.



Below programs illustrate the Imagick::removeImageProfile() function in PHP:

Program 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Create a new Imagick object
$imagick = new Imagick(
  
// Add two profiles
$imagick->setImageProfile('name1', 'profile1');
$imagick->setImageProfile('name2', 'profile2');
  
// Remove the first profile
$imagick->removeImageProfile('name1');
  
// Get all the profiles
$profile $imagick->getImageProfiles('*');
print("<pre>".print_r($profile, true)."</pre>");
?>

chevron_right


Output:

Array
(
    [name2] => profile2
)

Program 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Create a new Imagick object
$imagick = new Imagick(
  
// Add two profiles
$imagick->setImageProfile('name1', 'profile1');
$imagick->setImageProfile('name2', 'profile2');
  
// Remove all profiles
$imagick->removeImageProfile('name1');
$imagick->removeImageProfile('name2');
  
// Get all the profiles
$profile $imagick->getImageProfiles('*');
print("<pre>".print_r($profile, true)."</pre>");
?>

chevron_right


Output:

// Empty array because we removed all the profiles
Array     
(
)

Reference: https://www.php.net/manual/en/imagick.removeimageprofile.php




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.