in reply to Re: Loading PNG in Perl?
in thread Loading PNG in Perl?

Wow, useful reference. If it's concise enough that may be useful to help me write my own loader, yes.

GD wouldn't be useful since it only creates images and doesn't read them.

Replies are listed 'Best First'.
Re^3: Loading PNG in Perl?
by BrowserUk (Patriarch) on Jul 31, 2008 at 04:16 UTC
    GD wouldn't be useful since it only creates images and doesn't read them.

    Not so. GD happily loads existing images in the usual formats:

    #! perl -slw use strict; use GD; my $img = GD::Image->new( $ARGV[ 0 ] ); my( $w, $h ) = $img->getBounds; print "The image '$ARGV[ 0 ]' is $w x $h pixels."; printf "The color of the pixel in the middle is: [0x%02x:0x%02x:0x%02x +].\n", $img->rgb( $img->getPixel( $w/2, $h/2 ) ); __DATA__ c:\test>junk5 694790clustered.png The image '694790clustered.png' is 800 x 800 pixels. The color of the pixel in the middle is: [0xfc:0xfe:0xfc]. c:\test>junk5 img\worldx2-2.jpg The image 'img\worldx2-2.jpg' is 5400 x 2700 pixels. The color of the pixel in the middle is: [0x04:0x0c:0x11]. c:\test>junk5 img\gradient.gif The image 'img\gradient.gif' is 108 x 108 pixels. The color of the pixel in the middle is: [0xff:0xff:0xff].

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Oh wow, i totally missed those. Thanks a lot!