Complex compsition with imagemagick

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
cogito
Posts: 6
Joined: 2011-03-18T11:08:06-07:00
Authentication code: 8675308

Complex compsition with imagemagick

Post 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
cogito
Posts: 6
Joined: 2011-03-18T11:08:06-07:00
Authentication code: 8675308

Re: Complex compsition with imagemagick

Post 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).
cogito
Posts: 6
Joined: 2011-03-18T11:08:06-07:00
Authentication code: 8675308

Re: Complex compsition with imagemagick

Post 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)?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Complex compsition with imagemagick

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Complex compsition with imagemagick

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
cogito
Posts: 6
Joined: 2011-03-18T11:08:06-07:00
Authentication code: 8675308

Re: Complex compsition with imagemagick

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Complex compsition with imagemagick

Post 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
Post Reply