1

I current have code that build a montage using ImageMagick. This is my line of code:

montage -mode Concatenate -tile ${tile} -geometry ${geometry}+0+0 ${input} ${output}

I'm using -label ${label} to name my labels (in my input var).

This gets me a montage with a lot of white space, like that:

enter image description here

I checked on the manual and forums but everyone seem to agree that the way to do this is to use concatenate or geometry +0+0. I am already using those and it does not work. I also read that the font should be automatically chosen to fit the free space. Right now, there is way too much white space.

My goal: To get the white space (between the tiles on the vertical) to fit the current labels height and nothing more.

If you have an idea, I would be really happy.

Thank you anyway guys!

PS: It also doesn't work without labels. I get:

enter image description here

PPS: I'm sorry if my english is not really good, I am french from Montréal, Qc, Canada.


UPDATE: Those are my settings:

tile=4x3
geometry=386x305
2
  • 1
    Can you expand the $tile & $geometry variables? As written, the example code does not produce the whitespace in the example images. Aug 14, 2014 at 1:57
  • I am sorry, I forgot my config. I added it right now on the bottom, under the "UPDATE" title. Thank you. Aug 14, 2014 at 13:55

1 Answer 1

4

The additional white space is coming from your geometry setting. The options -geometry 386x305+0+0 is adding an additional 15px between the image and the label.

whitespace between image and label

If you omit the WxH and add a non-zero value to the offset -geometry +0+15, then you'll have additional white space after the label.

whitepsace after label

To limit the white space to text height, and nothing more, just keep the option as -geometry +0+0.

no whitespace

I also read that the font should be automatically chosen to fit the free space.

I think that's reversed. The white space is determined by the typeface of the font. I wouldn't say fonts automatically adjust <blank>, but default to <blank>. It's always a good idea to define the font & pointsize.

1
  • TLDR; montage in1.jpg in2.jpg -geometry +0+0 out.jpg
    – MrMartin
    Aug 1, 2020 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.