Friday, October 17, 2025
HomeLanguagesPHP | Imagick labelImage() Function

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:




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


Output:

This is my label.

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

RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS