in reply to Re: Image size in pure perl
in thread Image size in pure perl

Image::Size requires Image::Magic which in its turn require the libmagic libraries so this is not a pure Perl solution, nor is it nearly as portable. You can depend on having pack and unpack

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: Re: Image size in pure perl
by PodMaster (Abbot) on Mar 07, 2003 at 07:21 UTC
    No it doesn't. Please examine the Makefile.PL and the documentation.
    Recognized Formats Image::Size natively understands and sizes data in the following formats:
    GIF 
    JPG 
    XBM 
    XPM 
    PPM family (PPM/PGM/PBM) 
    XV thumbnails 
    PNG 
    MNG 
    TIF 
    BMP 
    PSD (Adobe PhotoShop) 
    SWF (ShockWave/Flash) 
    PCD (Kodak PhotoCD, see notes below) 
    
    Additionally, if the Image::Magick module is present, the file types supported by it are also supported by Image::Size. See also "CAVEATS".
    There is a reason I am PodMaster ;D
    # NOTE: Derived from blib\lib\Image\Size.pm. # Changes made here will be lost when autosplit is run again. # See AutoSplit.pm. package Image::Size; #line 741 "blib\lib\Image\Size.pm (autosplit into blib\lib\auto\Image\ +Size\pngsize.al)" # pngsize : gets the width & height (in pixels) of a png file # cor this program is on the cutting edge of technology! (pity it's bl +unt!) # # Re-written and tested by tmetro@vl.com sub pngsize { my $stream = shift; my ($x, $y, $id) = (undef, undef, "could not determine PNG size"); my ($offset, $length); # Offset to first Chunk Type code = 8-byte ident + 4-byte chunk le +ngth + 1 $offset = 12; $length = 4; if (&$read_in($stream, $length, $offset) eq 'IHDR') { # IHDR = Image Header $length = 8; ($x, $y) = unpack("NN", &$read_in($stream, $length)); $id = 'PNG'; } ($x, $y, $id); } # end of Image::Size::pngsize 1;


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
    ** The Third rule of perl club is a statement of fact: pod is sexy.