PHP | Imagick labelImage() Function

The Imagick::labelImage() function is an inbuilt function in PHP which is used to add label to an image.

Syntax:

bool Imagick::labelImage( string $label )

Parameters: This function accepts a single parameter $label which holds the label to add to the image.



Return Value: This function returns TRUE on success.

Errors/Exceptions: This function throws ImagickException on error.

Below program illustrates the Imagick::labelImage() function in PHP:

Program:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Create a new imagick object
$imagick = new Imagick(
  
// Adding the label to the image
$imagick->labelImage("This is my label.");
  
// Getting the label of the image
$labelInImage = $imagick->getImageProperties("label");
  
// Display the label of image
echo $labelInImage['label'];
  
?>

chevron_right


Output:

This is my label.

Reference: https://www.php.net/manual/en/imagick.labelimage.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.