Image::Size - Determine the size of images in several common formats

Version: 3.0 (See CHANGES below)

WHAT IS IT

Image::Size is a library based on the image-sizing code in the wwwimagesize
script, a tool that analyzes HTML files and adds HEIGHT and WIDTH tags to
IMG directives. Image::Size has generalized that code to return a raw (X, Y)
pair, and included wrappers to pre-format that output into either HTML or
a set of attribute pairs suitable for the CGI.pm library by Lincoln Stein.
Currently, Image::Size can size images in XPM, XBM, GIF, JPEG, PNG, MNG, TIFF,
the PPM family of formats (PPM/PGM/PBM) and if Image::Magick is installed,
the formats supported by it.

I did this because my old WWW server generated a lot of documents on demand
rather than keeping them in static files. These documents not only used
directional icons and buttons, but other graphics to annotate and highlight
sections of the text. Without size attributes, browsers cannot render the
text of a page until the image data is loaded and the size known for layout.
This library enables scripts to size their images at run-time and include
that as part of the generated HTML. Or for any other utility that uses and
manipulates graphics. The idea of the basic interface + wrappers is to not
limit the programmer to a certain data format.


USING Image::Size IN YOUR SCRIPTS

Image::Size has pod documentation that gives a more complete overview, but
in a nutshell:

        use Image::Size;

        ($x, $y) = imgsize("something.gif");

And ($x, $y) is now the width and height of something.gif. 95% of my usage of
this library is in conjunction with Lincoln Stein's CGI.pm:

        use CGI ':all';
        use Image::Size 'attr_imgsize';

        #
        # Emit an IMG tag with size attributes:
        #
        print img({-SRC => '/server/images/arrow.gif',
                   attr_imgsize('/server_root/server/images/arrow.gif')});

Alternately, if you are running under Apache and mod_perl:

        # Assume $Q is an object of class CGI, $r is an Apache request object
        $r->print($Q->img({ -src => $imgpath,
                            attr_imgsize($r->lookup_uri($imgpath)->
                                         filename) }));

BUILDING/INSTALLING

This package is set up to configure and build like a typical Perl extension.
To build:

        perl Makefile.PL
        make && make test

If Image::Size passes all tests, then:

        make install

You may need super-user access to install.


PROBLEMS/BUG REPORTS

Please send any reports of problems or bugs to rjray@blackperl.com.


CHANGES

Added test suites for POD correctness and POD coverage.

Implemented and documented a flag called $Image::Size::GIF_BEHAVIOR that
controls whether the GIF code returns the screensize, the first sub-image
or the largest of the sub-images.

Applied a patch from mrj@mrj.spb.ru to fix usage of the Compress::Zlib
module in the handling of compressed flash files. Added a new SWF file to
test this, and added reference to the file in MANIFEST and t/all.t.

Delay Image::Magick loading until it is needed. (Mark Stosberg).
Add support for Graphics::Magick as an alternative to Image::Magick.
If either Graphics::Magick or Image::Magick is loaded into memory
that module will be used. Otherwise, they are both tried to be loaded,
with Graphics::Magick being tried first. (Mark Stosberg). This patch also
adds a new test suite, t/magick.t, to the distribution and modifies both
MANIFEST and Makefile.PL (to add a build-dependancy on Test::More).

With Test::More now required for building, converted t/all.t to use it.
