montage: wordwrap of long labels

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
f.gruber
Posts: 2
Joined: 2012-01-26T14:18:46-07:00
Authentication code: 8675308
Location: Bad Schallerbach, Austria

montage: wordwrap of long labels

Post by f.gruber »

Hi,
is there any way to wordwrap long filenames?
I use this command:

Code: Select all

montage -label %f -geometry 150x150+10+10 *.jpg outfile.jpg
In my example the filenames are too long for the given size of 150x150 and therefore they are overlapped. That looks ugly.
Is there any way to work around this?

Thank you for tipps.
Ferdinand
Regards from Austria
Ferdinand
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: montage: wordwrap of long labels

Post by fmw42 »

I don't believe that montage has the equivalent to caption: that does word wrapping. However, even that is at word boundaries. So it would not help if your filenames do not have white spaces.

You can set the font and pointsize to a smaller value to save space in montage. see http://www.imagemagick.org/Usage/montage/#settings

You can also increase the -geometry size so that there is more space for the filenames.

The only other thing I can think of is for you to add comments to each of your images with the filename or whatever formatted (with \n) the way you might want (every so many characters) and then use -label "%c" with montage. However, I am not sure what happens with the \n in comments.
see http://www.imagemagick.org/Usage/montage/#metadata

However, having an automatic wrap at the width of the image would make a useful enhancement to montage, if it is practical to do so.
Post Reply