PHP | Imagick commentImage() Function Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The Imagick::commentImage() function is an inbuilt function in PHP which is used to add the comment in an image. Syntax: bool Imagick::commentImage( $comment ) Parameters: This function accepts a single parameter $comment which is used to hold the comment. Return Value: This function returns True on success. Original Image: Below programs illustrate the Imagick::commentImage() function in PHP: Program 1: php <?php // require_once('vendor/autoload.php'); // Create an Imagick Object $image = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-15.png'); // Add comment to the image $image->commentImage("GeeksforGeeks"); // Display the comment echo $image->getImageProperty("comment"); ?> Output: GeeksforGeeks Program 2: Image created by Imagick Function: php <?php $string = "Computer Science portal for Geeks!"; // creating new image of above String // and add color and background $im = new Imagick(); $draw = new ImagickDraw(); // Fill the color in image $draw->setFillColor(new ImagickPixel('green')); // Set the text font size $draw->setFontSize(50); $metrix = $im->queryFontMetrics($draw, $string); $draw->annotation(0, 40, $string); $im->newImage($metrix['textWidth'], $metrix['textHeight'], new ImagickPixel('white')); // Draw the image $im->drawImage($draw); // Function to add border image $im->borderImage(new ImagickPixel('Blue'), 5, 5); // Function to add comment $im->commentImage("G4G"); // Function to set the image format $im->setImageFormat('png'); // Printing Added Comment echo $im->getImageProperty("comment"); ?> Output: G4G Reference: https://www.php.net/manual/en/imagick.commentimage.php Comment More infoAdvertise with us Next Article PHP | Imagick cropImage() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP Image-Processing PHP-function PHP-Imagick +1 More Similar Reads PHP | Gmagick commentImage() Function The Gmagick::commentImage() function is an inbuilt function in PHP which is used to add the comment in an image. Syntax: Gmagick Gmagick::commentImage( $comment ) Parameters: This function accepts a single parameter $comment which is used to hold the comment. Return Value: This function returns the 1 min read PHP | Imagick contrastImage() Function The Imagick::contrastImage() function is an inbuilt function in PHP which is used to change the contrast of the image. This function enhances the intensity differences between the lighter and darker elements of the image. Syntax: bool Imagick::contrastImage(bool $sharpen) Parameters: This function a 1 min read PHP | Imagick cropImage() Function The Imagick::cropImage() function is an inbuilt function in PHP which is used to extracts the region of the image.Syntax:  int Imagick::cropImage( $width, $height, $x, $y ) Parameters: This function accept four parameters as mention above and describe below.  $width: This parameter is used to spec 2 min read PHP | ImagickDraw comment() Function The ImagickDraw::comment() function is an inbuilt function in PHP which is used to add a comment to a vector output stream. The comment is appended at the end of the output stream. Syntax: bool ImagickDraw::comment( string $comment ) Parameters: This function accept a single parameter $comment which 2 min read PHP | Imagick clone() Function The Imagick::clone() function is an inbuilt function in PHP which is used to create a copy of Imagick object. This function creates copy of the same instance, that means it will have same properties and any change in it will not reflect to the main object. Syntax: Imagick Imagick::clone( void ) Para 1 min read PHP | Imagick enhanceImage() Function The Imagick::enhanceImage() function is an inbuilt function in PHP which is used to improve the quality of a noisy image. This function applies the digital filter to improve quality. Syntax: bool Imagick::enhanceImage( void ) Parameter: This function does not accepts any parameter. Return Value: Thi 1 min read Like