PHP | ImagickDraw setTextDecoration() Function Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The ImagickDraw::setTextDecoration() function is an inbuilt function in PHP which is used to specify the decoration to be applied when annotating with text. Syntax: bool ImagickDraw::setTextDecoration( $decoration ) Parameters: This function accepts a single parameter $decoration which is used to hold the value of DECORATION_ constant. The list of DECORATION_ constants are given below: imagick::DECORATION_NO (integer) imagick::DECORATION_UNDERLINE (integer) imagick::DECORATION_OVERLINE (integer) imagick::DECORATION_LINETROUGH (integer) Return Value: This function does not return any value. Below programs illustrate the ImagickDraw::setTextDecoration() function in PHP: Program 1: php <?php // Create an ImagickDraw object $draw = new ImagickDraw(); // Set the image filled color $draw->setFillColor('green'); // Set the font size $draw->setFontSize(60); // Set the Text Decoration $draw->setTextDecoration(4); // Set the text to be added $draw->annotation(50, 75, "GeeksForGeeks"); // Create new Imagick Object $imagick = new Imagick(); // Set image dimensions $imagick->newImage(500, 160, 'white'); // Set the image format $imagick->setImageFormat("png"); // Draw the image $imagick->drawImage($draw); header("Content-Type: image/png"); // Display the image echo $imagick->getImageBlob(); ?> Output: Program 2: php <?php // Create an ImagickDraw object $draw = new ImagickDraw(); // Set the image filled color $draw->setFillColor('yellow'); // Set the font size $draw->setFontSize(20); // Set the TextDecoration() function // Text is Upperline $draw->setTextDecoration(3); // Set the text to be added $draw->annotation(50, 75, "A Computer Science Portal For Geeks!"); // Create new Imagick Object $imagick = new Imagick(); // Set the image dimensions $imagick->newImage(500, 160, 'black'); // Set the image format $imagick->setImageFormat("png"); // Draw the image $imagick->drawImage($draw); header("Content-Type: image/png"); // Display the image echo $imagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/imagickdraw.settextdecoration.php Comment More infoAdvertise with us Next Article PHP | ImagickDraw setTextUnderColor() Function S sarthak_ishu11 Follow Improve Article Tags : Technical Scripter Web Technologies PHP Image-Processing PHP-function PHP-Imagick +2 More Similar Reads PHP | GmagickDraw settextdecoration() Function The GmagickDraw ::settextdecoration() function is an inbuilt function in PHP that is used to specify the decoration to be applied when annotating with text. Syntax: public GmagickDraw::settextdecoration( $decoration ) : GmagickDraw Parameters: This function accepts a single parameter $decoration wh 2 min read PHP | ImagickDraw setTextEncoding() Function The ImagickDraw::setTextEncoding() function is an inbuilt function in PHP which is used to set the code set used for text annotations. These code sets tell the computer how to interpret raw zeroes and ones into real characters. Usually, they produce the same text but use different code sets. Syntax: 2 min read PHP | ImagickDraw setTextKerning() Function The ImagickDraw::setTextKerning() function is an inbuilt function in PHP which is used to set the text kerning which defines the spacing between the text. Syntax: bool ImagickDraw::setTextKerning( float $kerning ) Parameters: This function accepts a single parameter $kerning which holds the text ker 1 min read PHP | ImagickDraw setTextUnderColor() Function The ImagickDraw::setTextUnderColor() function is an inbuilt function in PHP which is used to set the color of a background rectangle to place under text annotations. Syntax: bool ImagickDraw::setTextUnderColor( $under_color ) Parameters: This function accepts a single parameter $under_color which is 2 min read PHP | GmagickDraw settextencoding() function The GmagickDraw::settextencoding() function is an inbuilt function in PHP which is used to set the code set used for text annotations. These code sets tell the computer how to interpret raw zeroes and ones into real characters. Usually, they produce the same text but use different code sets. Syntax: 2 min read PHP | ImagickDraw setTextAntialias() Function The ImagickDraw::setTextAntialias() function is an inbuilt function in PHP which is used to control whether the text is antialiased. The text is antialiased by default. Syntax: bool ImagickDraw::setTextAntialias( $antiAlias ) Parameters: This function accepts a single parameter $antiAlias which is u 2 min read Like