I want to draw a rectangle with two strings in it. I want the first string to be 15pt size (its a number), second to be 10pt size (the label). It’s easy to draw single string with one size to the rectangle, I do it like this:
$image = new Imagick('someimage.png');
$draw = new ImagickDraw;
$draw->setGravity(Imagick::GRAVITY_CENTER);
$draw->setfont(__DIR__ . DS . 'TREBUCBD.TTF');
$draw->setfontsize(15);
$draw->annotation(0, 0, '50 points');
$image->drawImage($draw);
The idea here is to have “50” in “50 points” to be big.
I tried to do a $draw->push() to push the current settings to the stack then set the font size and annotation again but then the two strings overlap. I’ve been trying to do this for hours. Any help is very appreciated!
The above implementation is in PHP but probably I will manage to do it even by example that shows it with command line ImageMagick usage.
edit: I’ve started a bounty that I will award for a solution implemented in PHP.
Add enough space before “points” and after the “50” so you align them nicely: