Page 1 of 1
trouble creating contact sheet with montage
Posted: 2018-04-17T15:06:10-07:00
by timjusttim_IM
I'm fairly new to this so apologies up front.
I want to make a multi-page pdf (8.5"x11"-letter) contact sheet based on the contents of a folder using a batch file. So far so good. Where I run into trouble is: I want margins around the outside of the content so that it prints correctly on a printer (also so it looks nicer). I feel like I'm very close with the code below but all my content is left and bottom aligned (all the margin winds up above and to the left). I'v tried a couple of things like adding "+50" to my page tag, but my labels start to lose alignment and get cropped. I tried gravity and that broke it so that nothing showed up. I read elsewhere someone solved this problem by running the resultant pdf through montage again to add the margin, but I can't get that to work (I get an error message).
Code: Select all
montage -verbose^
-define jpeg:size=225x225 ^
-page 1224x1584^
-geometry 225x225+2+10 ^
-title "%%~n1" ^
-tile 4x5 ^
-label %%f ^
-font Arial ^
-pointsize 8 ^
-density 150^
-background "#ffffff" ^
-fill "black" ^
-auto-orient ^
%~dp1*.JPG^
%~dp1temp.pdf
Thanks in advance
—Tim
Re: trouble creating contact sheet with montage
Posted: 2018-04-17T17:36:54-07:00
by fmw42
Resize your images small enough that you leave room for the margins, via your -geometry setting. Then do the montage. Then add a white border around the outside with enough thickness in pixels to produce 1 inch of margin. Your density is 150 dpi so for one inch, the -border value would be 150. Therefore you need to reduce the pixel dimensions of your images by that much divided by the number of tiles in X and similarly in Y.
Alternately, you can do what you have, then resize the montage smaller to allow for the one inch all around and the add the white border. However, that would do an extra resize that would cause some small extra blurring of your images. So the first way is best.
Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at
http://www.imagemagick.org/discourse-se ... f=1&t=9620
For novices, see
http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
Re: trouble creating contact sheet with montage
Posted: 2018-04-18T06:38:25-07:00
by timjusttim_IM
Hi fmw42,
Thanks for your response.
I had read the before posting but was in a rush when I posted and forgot to add my version info:
ImageMagick 6.9.0-1 Q16 x64 2014-12-22
I think I'm not clear on what your recommending. I added "-border 150" to my above script and this is what I got:
https://imgur.com/PKLZC8K
here is what I had before:
https://imgur.com/a/MMvapqD
and here is what I want (roughly):
https://imgur.com/odjzURy
are you suggesting a 2nd command to apply the border or is this contained in the same montage command?
Thanks again for your help
Re: trouble creating contact sheet with montage
Posted: 2018-04-18T09:23:46-07:00
by fmw42
So you want a border around each tiled image, not a border around the montage. Is that correct?
If so, then you need to add the -bordercolor and the -border arguments. For example, try this
montage lena.jpg -duplicate 3 -tile 2x2 -background white -bordercolor gray -border 20 -geometry 64x64+20+20 lena_montage.jpg
Re: trouble creating contact sheet with montage
Posted: 2018-04-18T11:13:42-07:00
by timjusttim_IM
fmw42,
I'm looking for the opposite of that. I want a border around the montage. like this:
Thanks again for your help
Re: trouble creating contact sheet with montage
Posted: 2018-04-18T13:41:04-07:00
by fmw42
That is what I told you how to do earlier. Make each tile smaller via -geometry, then pipe the output from montage to convert - -bordercolor white -border 150.
Code: Select all
montage lena.png -duplicate 3 -tile 2x2 -background white -geometry 64x64+5+5 miff:- | convert - -bordercolor white -border 50 lena_montage2.jpg
Re: trouble creating contact sheet with montage
Posted: 2018-04-19T07:00:39-07:00
by timjusttim_IM
Thanks! That's exactly what I needed. In case its useful for anyone, the code I've thus far settled on is below:
Code: Select all
montage -verbose^
-define jpeg:size=250x250 ^
-geometry 250x250+15+10 ^
-title "%~n1" ^
-tile 4x5 ^
-label %%f ^
-font Arial ^
-pointsize 6 ^
-density 150^
-background "#ffffff" ^
-fill "black" ^
-auto-orient ^
"%~f1\*.JPG" ^
miff:- | convert - -bordercolor white^
-border 77^
"%~f1\%~n1_CS.pdf"
and the result: