Page 1 of 1

How to draw two strings over image with different size?

Posted: 2011-08-28T08:39:50-07:00
by ddinchev
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:

Code: Select all

$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);
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.

Re: How to draw two strings over image with different size?

Posted: 2011-09-03T03:33:53-07:00
by ddinchev
Anyone? :(

I have started a bounty on stack overflow for this:
http://stackoverflow.com/questions/7221 ... over-image

Re: How to draw two strings over image with different size?

Posted: 2011-09-04T16:57:18-07:00
by anthony
create two separate images (labels:) for the two strings, append them vertically, then overlay them in the center off your image.