I have some images which I want to merge. By this I mean that if I have 5 images, I want to arrange them in this way:
I want to do this using a command so that I can use a Bash script for it. For example the command could be like this:
foo image1 image2 image3 image4 image5
I have lots of images so the command should be able to process a large number of files.
The output can be PDF or even in image format.
See the
montage
command fromimagemagick
(sudo apt-get install imagemagick
).This will resize each image (to 250px with no deformation) and combine them with no margin.
More montage examples.
You can also use
convert
(example with wildcards):I was doing something similar the other day. Grids are in, it seems. In my case I had a variable number of images being piped into the grid and I just wanted to create a 17 wide image by however many images tall.
That just uses 136 rose images to form a 8-tile-high grid. Obviously you'll want to change the
$(...)
group for a list of your input images. And you'll want to set the tile variable to something like2x
if you just want to set the number of tiles.In terms of outputting to PDF, you can just change the extension. So you would be looking at something like: