Montage: Icons with labels inside a single line rectangle

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
imagemerlin
Posts: 5
Joined: 2012-12-28T16:23:44-07:00
Authentication code: 6789

Montage: Icons with labels inside a single line rectangle

Post by imagemerlin »

Hello,

first a thank for that really valuable tool! Just getting started with generating contact sheets of icons. All icons with their labels should be placed inside a single line rectangle (one for every icon/label, nothing fancy). How can I achieve that?


Many thanks for hints and greetings
imagemerlin
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Montage: Icons with labels inside a single line rectangl

Post by fmw42 »

I am not sure I understand, but take a look at http://www.imagemagick.org/Usage/montage/

If that does not help, the please provide links to an example of the input and output you desire and/or explain in more detail. Also it is always a good idea to identify your version of IM and platform as the syntax may differ for Unix vs Windows.
imagemerlin
Posts: 5
Joined: 2012-12-28T16:23:44-07:00
Authentication code: 6789

Re: Montage: Icons with labels inside a single line rectangl

Post by imagemerlin »

Hello fmw42,

the icons with their labels should look like:

Code: Select all

+----------+ +----------+     +----------+
|   Icon   | |   Icon   |     |   Icon   |
|          | |          | ... |          |
|   Label  | |   Label  |     |   Label  |
+----------+ +----------+     +----------+

...

+----------+ +----------+     +----------+
|   Icon   | |   Icon   |     |   Icon   |
|          | |          | ... |          |
|   Label  | |   Label  |     |   Label  |
+----------+ +----------+     +----------+
The usage descriptions are really good and detailed, but even after some hours testing many command lines I haven't found a solution.

I'm using WIN 7 64bit and ImageMagick 6.8.1-3!


Many thanks and greetings
imagemerlin
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Montage: Icons with labels inside a single line rectangl

Post by fmw42 »

How are your labels defined? Montage allows you to specify a label with each image. see http://www.imagemagick.org/Usage/montage/#label

You can set the number of icons horizontally and vertically with the -tile parameter and the spacing between icons with -geometry.

I am assuming that the label will go below the image. That is how montage works. If you want the label inserted at the bottom of the image, then separate steps are needed to loop over each image and insert the label where you want it in the image. That is done with label: with a tranparent background and compose that inserts the label image into the icon image or with -annotate or -draw right on the icon image. See http://www.imagemagick.org/Usage/text/#label and http://www.imagemagick.org/Usage/text/#annotate and http://www.imagemagick.org/Usage/text/#draw

Once I know what you need, I can probably give you an example. Can I assume all icons are the same size?
imagemerlin
Posts: 5
Joined: 2012-12-28T16:23:44-07:00
Authentication code: 6789

Re: Montage: Icons with labels inside a single line rectangl

Post by imagemerlin »

Hello again fmw42,

many thanks for your answer. I don't have any problems with the montage command itself. That's all working. Yep, all icons have the same size, 16x16. And I'm using parameters

Code: Select all

-geometry "150x20>+2+2"
-label %t
-font Courier-New -pointsize 8
because my file names are so long.
I only need a hint how I can get that simple, single line border (black, NO frame) and a white background for the icon and a white background for the label (maybe I change the colors later).

I tried already the -tile parameter. Works perfect. The next step would then to populate an A4 sheet (pdf file) - the size of the icons must be preserved (1:1, 16x16). I already looked for the corresponding forum topics (-resize/-extent/-density). Seems quite complicated.


Many thanks and greetings
imagemerlin
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Montage: Icons with labels inside a single line rectangl

Post by fmw42 »

Is this what you want? If not, please explain in more detail.


montage -label "%f" zelda3.jpg lena2.jpg checks.jpg mandril.jpg -tile 2x -background white -geometry +1+1 montage_result.jpg

Image
imagemerlin
Posts: 5
Joined: 2012-12-28T16:23:44-07:00
Authentication code: 6789

Re: Montage: Icons with labels inside a single line rectangl

Post by imagemerlin »

Hello again fmw42,

with single line rectangle (border): https://www.dropbox.com/s/yvq0hzy3kelfd ... border.jpg

Thanks for the tip off Dropbox.


Many thanks and greetings
imagemerlin
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Montage: Icons with labels inside a single line rectangl

Post by fmw42 »

One pass of montage will only do this.

montage -label "%f" zelda3.jpg lena2.jpg checks.jpg mandril.jpg \
-tile 2x -background white -bordercolor black -border 1 -geometry +1+1 montage_result2.jpg

Image


You need two passes. The first will add the label to each image and store as multiframe miff: (IM internal images) then piped and the second will put the black border around the labeled images and format into tiles.

montage -label "%f" zelda3.jpg lena2.jpg checks.jpg mandril.jpg -background white -geometry +0+0 -tile 1x1 miff:- |\
montage - -tile 2x -background white -bordercolor black -border 1 -geometry +1+1 montage_result3.jpg

Image


If you do not want the 1pixel white border around the whole thing, then

montage -label "%f" zelda3.jpg lena2.jpg checks.jpg mandril.jpg -background white -geometry +0+0 -tile 1x1 miff:- |\
montage - -tile 2x -background white -bordercolor black -border 1 -geometry +1+1 miff:- |\
convert - -trim montage_result4.jpg

Image
Post Reply