Ramon Ramon - 5 months ago 29
PHP Question

How do I change the color of a caption drawn with PHP Imagick's newPseudoImage function?

I am creating an image with a caption using the

function as follows:

$txt = new Imagick();
$txt->newPseudoImage( $image_width, $image_height, "caption:" . $text );

This draws a black caption. I want to customize the color of this caption. I know there are other methods of drawing text with Imagick. I need to use the
with caption instead of these other methods because it automatically wraps and sizes the text to fit in a given rectangle.


You can use colorizeImage. I hope this can help you:

$im = new Imagick();
$background = new ImagickPixel('none');


$im->newPseudoImage(300, 300, "caption:" . "Put your text" );

header( "Content-Type: image/png" );
echo $im;