The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Imager::Montage - montage images

VERSION

Version 0.01

SYNOPSIS

    # Generate a montage image.

    use Imager::Montage;

    my $im = Imager::Montage->new;
    my @imgs = <*.png>;
    my $page = $im->gen_page(
        {   
            files       => \@imgs,
            geometry_w  => 200,  # geometry from source. if not set , the resize_w , resize_h will be the default
            geometry_h  => 200,  # if we aren't going to resize the source images , we should specify the geometry at least.
            cols        => 5,
            rows        => 5,
        }
    );
    $page->write( file => 'page.png' , type => 'png'  );  # generate a 1000x1000 pixels image with 5x5 tiles

EXPORT

Methods

new
_load_image

return a Imager object

    $imager = $self->_load_image( $filename );
_load_font

Return Imager::Font

    my $font = _load_font( { file => '/path/to/font.ttf' , color => '#000000' , size => 72 } );
_load_color

return Imager::Color

    $self->_load_color( '#000000' );
gen_page

montage your source image . it will return an Imager Object.

    my $page = $im->gen_page(
        {   
            files    => \@imgs,
            resize_w => 100,
            resize_h => 100,
            cols     => 3,
            rows     => 3,
            margin_v => 5,
            margin_h => 5,

            page_width       => 800,
            page_height      => 600,
            background_color => '#ffffff',

            flip         => 'h',                             # horizontal flip
            flip_exclude => ' return $file =~ m/d\d+.png/ '
            ,    # don't flip files named \d+.png  ( optional )

            frame       => 4,           # ( optional )
            frame_color => '#000000',

            border       => 4,
            border_color => '#000000',

            res => 600,
        }
    );

Parameters:

files: an array contains filenames

background_color: background color of output image

geometry_h, geometry_w: geometry from source. if not set , the resize_w , resize_h will be the default

resize_w, resize_h): if it's given , montage will resize your source image to this size

cols, rows: tiles

margin_v,margin_h: margin for each image

page_width, page_height: the output image width & height

flip: do flip to each source image

flip_exclude

frame: frame width (optional)

frame_color: frame color (optional)

border: border width for each image (optional)

border_color: border color (optional)

res: resolution , default resolution is 600 (optional)

_set_resolution

default resolution is 600 dpi

    $self->_set_resolution( $filename , 600 );
    $self->_set_resolution( $imager  );

AUTHOR

Cornelius, <c9s at aiink.com>

BUGS

Please report any bugs or feature requests to bug-imager-montage at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Imager-Montage. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Imager::Montage

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2007 Cornelius, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.