GD::Image::CopyIFS

GD::Image::CopyIFS is a Perl module for fractal-based image copying and resizing.
Download

GD::Image::CopyIFS Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Randy Kobes
  • Publisher web site:
  • http://search.cpan.org/~rkobes/

GD::Image::CopyIFS Tags


GD::Image::CopyIFS Description

GD::Image::CopyIFS is a Perl module for fractal-based image copying and resizing. GD::Image::CopyIFS is a Perl module for fractal-based image copying and resizing.SYNOPSIS # zoom in on an area of an image use GD::Image::CopyIFS; my $width = 64; my $height = 60; my $scale = 4; my $neww = $scale * $width; my $newh = $scale * $height; my $src_file = 'src.jpeg'; my $src_img = GD::Image->newFromJpeg($src_file, 1); my $dst_img = GD::Image->new($neww, $newh, 1); my @opts = ($src_img, 0, 0, 110, 120, $neww, $newh, $width, $height); $dst_img->copyIFS(@opts); my $dst_file = 'dst.jpeg'; open(my $fh, '>', $dst_file) or die "Cannot open $dst_file: $!"; binmode $fh; print $fh $im->jpeg; close $fh; # create a resized image scaled by a factor $scale use GD::Image::CopyIFS; my $src_file = 'src.jpeg'; my $src_img = GD::Image->newFromJpeg($src_file, 1); my $scale = 2.45; my $dst_img = GD::Image->thumbIFS($src_img, scale => $scale); my $dst_file = 'dst.jpeg'; open(my $fh, '>', $dst_file) or die "Cannot open $dst_file: $!"; binmode $fh; print $fh $im->jpeg; close $fh;This module adds to the GD::Image module of GD two methods: copyIFS, used to copy and resize an area of one image onto another image, and thumbIFS, used to create a rescaled image from an original. The copyIFS method is used analagously to the copyResized or copyResampled methods of the GD module.The algorithm employed uses what is known as a fractal interpolating function, which uses an Iterated Function System (IFS) to interpolate functions specified at discrete points. The basic procedure is to create an IFS based on the pixel colors of an image, and then from this construct a new IFS based on the parameters specified when rescaling an area of the image. A random iteration algorithm is then used to construct an image from this new IFS. For details, see http://ecommons.uwinnipeg.ca/archive/00000026/.Note that this algorithm may give good results for images of natural objects, as there is generally a fractal nature present in most such shapes. It typically will not give good results for more geometric shapes, such as lettering. Requirements: · Perl


GD::Image::CopyIFS Related Software