Image::Size

Version 3.1.1

What Is It?

The Image::Size package is an extension module for Perl, versions 5.006 and higher. The module is comprised entirely of Perl code, and thus does not require any compilation or linking for use. Some users on Microsoft-based platforms have encountered installation problems, these are addressed in the file README.Win32 contained in the distribution from version 2.902 forward.

More specifically, Image::Size is a module that retrieves height and width specification from an image file. It recognizes most of the more common formats, including (but not limited to, see the manual page) JPEG, GIF, PNG, XBM, XPM, BMP and the PPM family.

Example Usage

The primary design goal behind this module was to allow for run-time derivation of image sizes in CGI applications. This would prevent dubious design moves such as hard-coding such data within applications or HTML templates. With the introduction of the Apache web server and the mod_perl module for it, the module became even more useful. Among the features that Image::Size calls upon are cacheing of image information (by fully-qualified path name and with modification-time tests) and lightweight code usage-- the code to determine the size of a particular type of image is not loaded and compiled until an image of that type is accessed.

Given the Apache model of process persistence, it is possible to pre-cache commonly-accessed images at server start-up and by doing so cause all child processes to "inherit" this cache when first spawned. In addition to this capability, the Apache/mod_perl relationship bridges the gap between image URIs and their fully-qualified path names.

In addition to use under Apache, the software can also provide image size attributes for the Perl/Tk extension. A variety of entry points are provided, including a basic, unformatted output style suitable for creating specialized formatting.

Code examples are provided in the manual page.

Getting the Software

This package is available via the Comprehensive Perl Archive Network, or CPAN, indexed by my CPAN user-id, RJRAY. You can go directly to the package via this link:

http://search.cpan.org/search?dist=Image-Size

This will always refer to the latest version CPAN has available.

System Requirements

In general, any system that can run Perl version 5.004 and newer should be able to install and use this module without difficulty. As it does not make use of any XS or C code for linkage, it has been tested successfully with MacPerl and ActiveState's Windows port of Perl, as well as various Linux, BSD and UNIX systems.

Other Documentation

The manual page
 
The README file
 
The README.Win32 file
 
The ChangeLog file
 
 
Japanese translation of the manual page, by Kawai Takanori