Make grids of images

Ever need to create subplots (or a nice mosaic of images) and can’t be bothered to figure out how todo it in what ever programming language, or have to open up photoshop or gimp and have to manually reposition everything? Well Imagemagik (like always) can solve this(!) and a friend of mine wanted to do this automatically the other day so I created a little bash script to do the job: combine_intogrid.sh
Here is an example of the output (I used (the top left image) an image I took of M51 and applied some filters to it (see bottom of post for filters):
final
For just one set of images (say you want a 4×1 mosaic you have to run this:

convert ( image1.png image2.png image3.png image4.png +append ) -background none -append final.png

and say for a 2×2 then its just:

convert ( image1.png image2.png +append ) ( image3.png image4.png +append ) -background none -append final.png

The script is essentially designed todo more than one directory at a time and was for astronomical images (hence the use of source in the directories) just replace this and off you go – it will loop through all your directories making nice mosaics of your images.
Filters / process to convert the one image into the 4 used for the mosaic:

convert image1.jpg image1.png
convert image1.png -negate image2.png
convert image2.png -blur 5×2 image3.png
convert image1.png -level 25%,100% image4.png
convert ( image1.png image2.png +append ) ( image3.png image4.png +append ) -background none -append final.png
mogrify -resize 400 final.png

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: