Open In App

PHP | Imagick labelImage() Function

Last Updated : 08 May, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report
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: php
<?php

// Create a new imagick object
$imagick = new Imagick(
'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png');

// 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'];

?>
Output:
This is my label.
Reference: https://www.php.net/manual/en/imagick.labelimage.php

Next Article

Similar Reads