« WolframAlpha Widgets | Main | Awk sexigesimal to decimal »

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 4x1 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 2x2 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 5x2 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


TrackBack

TrackBack URL for this entry:
http://www.krioma.net/cgi-bin/mt_new/mt-tb.cgi/456

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on August 2, 2010 12:37 AM.

The previous post in this blog was WolframAlpha Widgets.

The next post in this blog is Awk sexigesimal to decimal.

Many more can be found on the main index page or by looking through the archives.

Get Firefox! Valid XHTML 1.0! Valid CSS! RSS Feed BlogUniverse - listed Powered by Apache Creative Commons License ringsofsaturnrock's Most Interesting Photos on Flickriver

Powered by
Movable Type 3.33