random walk through fields of musings

Wednesday, December 24, 2008

photos side-by-side aka montages

I seem to do this infrequently enough that I need to make myself a reminder, luckily I wrote a script that is pretty self-explanatory -- in this example it puts two photos side by side (similar method can be used to make 6 2"x2" passport photographs print on a single 4x6 print -- much cheaper than going to one of those passport places).


#!/usr/bin/perl

use strict;
local($|) = 1;

use Image::Magick;
my(@file) = @ARGV;

my($rv);

my($image)=Image::Magick->new;

$rv = $image->Read(@file);
warn "$rv" if $rv;

my($montage) = $image->Montage(
tile=>'2x1',
geometry=>'1704x2272',
mattecolor=>'#FFFFFF', #does not take?
frame=>'10',
);

$rv = $montage->Write('mp.jpg');
warn "$rv" if "$rv";


If you have ImageMagick installed but not the perl bindings, you can do this on the command line too.

2 comments:

Rick said...

The first thing I got out of this post was that passport photos no longer have to be on some special heat-sensitive photo paper any more (last time I needed a passport photo was long ago).

Rick said...

Or rather, heat-resistant photo paper.