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

NAME

Image::Magick::PixelMosaic - Pixelized mosaic filter for Image::Magick.

SYNOPSIS

  use Image::Magick;
  use Image::Magick::PixelMosaic;

  my $img = Image::Magick->new;
  $img->Read('hoge.jpg');
  my $pix = Image->Magick::PixelMosaic->new;
  $pix->src($img);

  # generates 4x4 pixelized mosaic on area (100,120)-(180,160)
  $pix->pixelize('80x40+100+120', [4,4]);

    

DESCRIPTION

This module generates pixelized mosaic on parts of images using Image::Magick.

METHODS

new [src => $obj]

Creates an Image::Magick::PixelMosaic object.

Optional src parameter expects Image::Magick object.

  my $pix = Image::Magick::PixelMosaic->new(src => $img);

is equal to

  my $pix = Image::Magick::PixelMosaic->new;
  $pix->src($img);
src, src($obj)

Get or set Image::Magick object.

pixelize geometry => geometry, pixelsize => pixel width&height

Generates pixelized mosaic on specified geometry.

geomerty must be specified as geometry form 'WxH+X+Y'.

pixelsize must be specified as one of 'WxH', [W,H] or W (height==width).

All of W, H, X and Y must be non-negative integer.

If geometry exceeds area of source image, it will be automatically cropped.

When height/width of image are '20x30' and

  $pix->pixelize('20x20+1+5', [4,6])

is called, efefctive pixelized area will be '16x24+1+5'.

SEE ALSO

Image::Magick

TODO

accept width/heigh/x/y options.

more pixel color decision algorithm (currently use average of pixel area)

AUTHOR

KATOU Akira (turugina) <turugina@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2008 by KATOU Akira (turugina)

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.