Image-Scale

 view release on metacpan or  search on metacpan

lib/Image/Scale.pm  view on Meta::CPAN


=head2 as_png()

Returns the resized PNG image as scalar data.

=head2 jpeg_version()

=head2 png_version()

=head2 gif_version()

Returns the version of the image library used.  Returns undef if support for that image
format was not built.

=head1 PERFORMANCE

These numbers were gathered on my 2.4ghz MacBook Pro with version 0.06.

JPEG image, 1425x1425 -> 100x100 (libjpeg-turbo 1.0.0 with pre-scaling)
Note that GD does not support JPEG pre-scaling which results
in very poor performance and high memory usage. These numbers also include
returning the resized image as a JPEG.

    GD copyResampled                        4.8/s
    resize_gm( { filter => 'Triangle' } )   127/s
    resize_gd_fixed_point                   128/s
    resize_gd                               131/s
    resize_gm_fixed_point                   133/s

PNG image, 350x350 -> 100x100 (libpng 1.4.3)
libpng is quite slow, probably because they were forced to remove a lot of assembly
code recently. These numbers also include returning the resized image as a PNG.

    GD copyResampled                        46.1/s
    resize_gm( { filter => 'Triangle' } )   61.4/s
    resize_gm_fixed_point                   64.9/s
    resize_gd                               76.0/s
    resize_gd_fixed_point                   77.6/s

Here are some numbers from a machine without floating-point support (version 0.01).
(Marvell SheevaPlug 1.2ghz ARM9, JPEG 1425x1425 -> 200x200, libjpeg 6b with scaling)

    GD copyResampled                        1.08/s
    resize_gd                               2.16/s
    resize_gm( { filter => 'Triangle' } )   2.85/s
    resize_gd_fixed_point                   7.98/s
    resize_gm_fixed_point                   9.44/s

And finally, from an even slower machine, the 240mhz Netgear ReadyNAS Duo which
has extremely poor floating-point performance (version 0.01).
(JPEG 1425x1425 -> 200x200, libjpeg 6b with scaling)

    resize_gd                               0.029/s (34.5 s/iter)
    resize_gm( { filter => 'Triangle' } )   0.033/s (30.4 s/iter)
    resize_gd_fixed_point                   1.92/s  (0.522 s/iter)
    resize_gm_fixed_point                   2.07/s  (0.483 s/iter) (63x faster than floating-point!)

=head1 SEE ALSO

L<GD>,
L<Image::Magick>,
L<Imager>

=head1 AUTHOR

Andy Grundman, E<lt>andy@hybridized.orgE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2010 Andy Grundman

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

=cut



( run in 1.646 second using v1.01-cache-2.11-cpan-39bf76dae61 )