Page 1 of 1
how to crop the labels in "montage"?
Posted: 2013-05-30T03:48:15-07:00
by jeancallisti
Hi everybody,
I'm facing the following problem but I don't know how to fix it :
I need to create a montage (using the "montage" tool), and I need to have the file names as label below each image (using -label %f).
However, the file names are quite long, but I can't afford to have a big horizontal gap between each image. So it can't be fixed with -geometry. Vertical gap doesn't matter, though.
Is there a way to cut the label so that it has a fixed width (preferably the width of the image), but it's split on several lines? (regardless of spaces -- i'm not looking for word wrap, just... let's say... characters wrap?)
Re: how to crop the labels in "montage"?
Posted: 2013-05-30T12:45:30-07:00
by fmw42
Is there a way to cut the label so that it has a fixed width (preferably the width of the image), but it's split on several lines? (regardless of spaces -- i'm not looking for word wrap, just... let's say... characters wrap?)
No, not that I am aware using montage, since it uses label: and not caption:. You would need to use caption and append the textimage created by caption below each image and then use montage to make your montage.
This could be done in a loop, to create the caption image, append it below the image and save each appended image as a multipage miff file and then pipe that to montage.
Note that to get any wrap of text there must be spaces in the file names. Is that the case with your names?
see
Re: how to crop the labels in "montage"?
Posted: 2013-05-30T13:31:11-07:00
by snibgo
In IM v6.8.5, IM "caption:" will split at words, but if a word is too long it is cropped.
In previous versions (eg v6.8.4), it splits between characters if necessary.
Re: how to crop the labels in "montage"?
Posted: 2013-05-30T13:32:53-07:00
by fmw42
snibgo wrote:In IM v6.8.5, IM "caption:" will split at words, but if a word is too long it is cropped.
In previous versions (eg v6.8.4), it splits between characters if necessary.
Can you provide an example. It sounds like a possible bug to crop a word.
Re: how to crop the labels in "montage"?
Posted: 2013-05-30T13:49:44-07:00
by snibgo
Code: Select all
convert -size 50x200 -box Yellow -pointsize 20 caption:"(abc adadadaddefghijkl)" c.png
In 6.8.4, all the characters are visible. Not so for 6.8.5.
With all the changes around caption etc, I don't know what the "correct" behaviour is supposed to be.
Re: how to crop the labels in "montage"?
Posted: 2013-05-30T14:14:33-07:00
by fmw42
I do not think caption is supposed to work if all 3 of width, height and pointsize are specified.
I am not sure but even if you leave off the pointsize it looks wrong to me. The only one that looks reasonable is
convert -size x200 -pointsize 20 caption:"(abc adadadaddefghijkl)" show:
Anthony's current notes at
http://www.imagemagick.org/Usage/text/#caption seem to imply that one can use all three, but that seems overdetermined to me. So one must take precedent over the others. He also points out that overflow can happen.
I would post this on the bugs forum and inquire if this is correct behavior, especially if you can show that in IM 6.8.4 it worked better.
Re: how to crop the labels in "montage"?
Posted: 2013-05-30T14:41:24-07:00
by snibgo