Page 1 of 1

Complex compsition with imagemagick

Posted: 2011-03-31T23:09:42-07:00
by cogito
Hi,
Is anyone able to help me getting proper command for imagemagick.
I have one big image, and several smaller.
For each smaller image I want to rotate it by some angle, add label on it (in the center) and then put in on top of bigger image. It's a process of creating map. So I have background, and several smaller object that can by placed anywhere. Each object can by rotated and should have a short label on it.

For now I have convert with several compositions, but I can't get labeling to work.
Please help.

thanks,
Cogito

Re: Complex compsition with imagemagick

Posted: 2011-04-01T03:07:26-07:00
by cogito
For now I have done something like this:
convert.exe big_image.png \( small_item.png -background none -rotate 45 -gravity center -draw 'text 0,0 "item name"' -gravity NorthWest -geometry x400+100+200 \) -composite result.png

But it's have one drawback, because I would like to have the text scaled to best fit the small_item size).

Re: Complex compsition with imagemagick

Posted: 2011-04-01T03:20:29-07:00
by cogito
Is there any way to create in memory semi transparent image with annotation that can be used on top of the smaller item image? How to properly handle the changing size (due to rotation)?

Re: Complex compsition with imagemagick

Posted: 2011-04-01T18:18:26-07:00
by fmw42
I have one big image, and several smaller.
For each smaller image I want to rotate it by some angle, add label on it (in the center) and then put in on top of bigger image. It's a process of creating map. So I have background, and several smaller object that can by placed anywhere. Each object can by rotated and should have a short label on it.
see viewtopic.php?f=1&t=18443

Re: Complex compsition with imagemagick

Posted: 2011-04-02T02:02:33-07:00
by anthony
If your adding a label to the center of a 'small object' the object must not be that small.

Perhaps an example of the 'object' will help give use a better idea.

How variable is the area? is the label always centered on the object? As the object rotates do you want the label to rotate?

However you may like to look at the examples for Drawing Arrows, Vectors, and Pointers..
http://www.imagemagick.org/Usage/draw/#arrows

Re: Complex compsition with imagemagick

Posted: 2011-04-02T07:14:02-07:00
by cogito
The whole process can be considered creating a map.
I have one big background.. up to 15000x15000. On that map I'm drawing several objects (actually pasting other images using composition) that can vary from 10x10 to 200x200 (or more).
I need to put a label on each of the small objects, for example a number.
For now ignore the rotation...
The problems I have at this point is that drawing text or label on top of object image might crop the label.
So the prefered way would be to move the label center point into center of the object... but I can't figure out how to do it.

Re: Complex compsition with imagemagick

Posted: 2011-04-02T10:42:01-07:00
by fmw42
So the prefered way would be to move the label center point into center of the object... but I can't figure out how to do it.
add -gravity center