Annotate vs label vs caption
Posted: 2017-02-24T15:43:59-07:00
I'm a bit stuck with this particular project, and I've been trying to implement some advice I received on this forum earlier today without much luck. I have a script that works but I don't know why I would choose to use caption/label over annotate, and how I would implement that.
P.s I'm sorry for a second post, I mucked up posting my first one - perhaps I should I have just edited this on top instead.
P.p.s My version is Version: ImageMagick 6.7.2-7 2016-06-17 Q16
Code: Select all
<?php
$text = 'The quick brown fox jumps over the lazy dog';
$width = 1000;
$height = 1000;
$textBackground = new ImagickPixel('transparent');
$textColor = new ImagickPixel('#000');
$gradient = new Imagick();
$gradient->newPseudoImage($width, $height, 'gradient:blue-red');
$image = new Imagick();
$image->newImage($width, $height, $textBackground);
$gradient->setImageColorspace($image->getImageColorspace());
$draw = new ImagickDraw();
$draw->setFillColor($textColor);
$draw->setFontSize( 10 );
$image->annotateImage($draw, 10, 45, 0, $text);
$gradient->compositeImage($image, Imagick::COMPOSITE_MATHEMATICS, 0, 0);
$gradient->setImageFormat('png');
header('Content-type: image/png');
echo $gradient;
return;
?>
P.p.s My version is Version: ImageMagick 6.7.2-7 2016-06-17 Q16