Brian Cassidy > GD-Image-Scale2x-0.07 > GD::Image::Scale2x

Download:
GD-Image-Scale2x-0.07.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.07   Source  

NAME ^

GD::Image::Scale2x - Implementation of the Scale2x algorithm for the GD library

SYNOPSIS ^

    use GD;
    use GD::Image::Scale2x;

    # load an image
    my $image = GD::Image->new( 'file.png' );

    # scale2x, 3x, and 4x
    my $scaled2x = $image->scale2x;
    my $scaled3x = $image->scale3x;
    my $scaled4x = $image->scale4x;

    # scale a certain area
    # (10, 10) to (30, 30)
    my $scaled = $image->scale2x( 10, 10, 20, 20 );

DESCRIPTION ^

This module implements the Scale2x algorithm (as well as 3x and 4x). From the Scale2x web site:

    Scale2x is real-time graphics effect able to increase the size of small bitmaps
    guessing the missing pixels without interpolating pixels and blurring the images.

The algorithm itself is explained at http://scale2x.sourceforge.net/algorithm.html. You can see some example results by looking through the test directory.

METHODS ^

scale2x( [ $source_x, $source_y, $width, $height ] )

Takes an image and produces one twice a big. From the Scale2x web site:

    The effect works repeating a computation pattern for every pixel of the
    original image. The pattern starts from a square of 9 pixels and expands
    the central pixel computing 4 new pixels.

You can specify a portion of the original image by specifying a source x and y plus a width and height.

scale3x( [ $source_x, $source_y, $width, $height ] )

A similar algorithm to scale2x, except that it produces a 9-pixel result.

scale4x( [ $source_x, $source_y, $width, $height ] )

Same as scale2x done twice over.

SEE ALSO ^

AUTHOR ^

Brian Cassidy <bricas@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright 2005-2009 by Brian Cassidy

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

syntax highlighting: