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?".
Mahroun
Posts: 23 Joined: 2011-12-24T02:52:08-07:00
Authentication code: 8675308
Post
by Mahroun » 2015-12-12T03:38:04-07:00
Hello everyone,
Is it possible to control items order and their labels when creating a contact sheet?
Right now I have the following command:
Code: Select all
montage.exe -gravity south -tile %tile% -verbose -label "%t" -quality 100 -define jpeg:size=200x200 -geometry 200x200+200+100> -auto-orient "D:\Pictures\CS\*.png" "D:\Pictures\CS\CS.png"
It loops "D:\Pictures\CS\" and creates a contact sheet of PNGs inside that folder and give each picture its name as a label, but what I need is a command to send to montage that includes items order and their labels and not their names.
Imaginary example:
Code: Select all
montage.exe "D:\Pictures\CS\zebra.png" -label "a zebra" "D:\Pictures\CS\snake.png" -label "a snake"...
TIA
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2015-12-12T11:20:15-07:00
You can label each image first and then send the results to montage. See
http://www.imagemagick.org/Usage/annotating/#annotating or you can write the label information into the meta data using convert image -set label "yourlabel" result and then in montage use -label "%l" to extract that label rather than the filename. Or you can do the same, but put the label information in the comment section of the meta data with -set comment "yourcomment" and use "%c" in montage. See
http://www.imagemagick.org/script/escape.php and
http://www.imagemagick.org/script/comma ... ns.php#set
Example:
Code: Select all
convert rose: -set comment "testing" -set label "test" rose.png
Code: Select all
identify -verbose rose.png
Properties:
comment: testing
label: test
So you could do both in one command (unix syntax):
Code: Select all
convert \
\( image1 -set comment "comment1" \) \
\( image2 -set comment "comment2" \) \
...
\( imageN -set comment "commentN" \) \
miff:- | montage -label "%c" - -tile ... result
For unix syntax, see
http://www.imagemagick.org/Usage/windows/ . Basically replace end of line \ with ^ and remove \ from before ( and before )
Mahroun
Posts: 23 Joined: 2011-12-24T02:52:08-07:00
Authentication code: 8675308
Post
by Mahroun » 2015-12-13T19:07:48-07:00
Thank you so much
One question though, how do I control the space/margin between the label and the image?
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2015-12-13T19:51:51-07:00
I do not think you can do it in montage, but you can do something like this by using -splice in the convert beforehand. See
http://www.imagemagick.org/Usage/crop/#splice
Code: Select all
convert \
\( image1 -set comment "comment1" -background white -gravity south -splice 0x5 \) \
\( image2 -set comment "comment2" -background white -gravity south -splice 0x5 \) \
...
\( imageN -set comment "commentN" -background white -gravity south -splice 0x5 \) \
miff:- | montage -label "%c" - -background white -tile ... result