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

As mentioned above: GD seems to be for creating only. ImageMagick might do it, but i'm really leery of using such a huge package, since i need to include all the necessary dlls and such in the package of the project i'm working on.

Speed is not a matter though.

Replies are listed 'Best First'.
Re^3: Loading PNG in Perl?
by dragonchild (Archbishop) on Jul 31, 2008 at 13:46 UTC
    Oh? GD's docs are horrid, so I can see why you missed the following:
    my $image = GD::Image->newFromPng($filename); my ($height, $width) = $image->getBounds; foreach my $x ( 0 .. $width ) { foreach my $y ( 0 .. $height ) { my ($index) = $image->getPixel($x,$y); my ($r,$g,$b) = $image->rgb($index); print "($x,$y) -> ($r,$g,$b)\n"; } }
    That will print out the RGB value for every XY coordinate, row-first. There's a ton of other information you can extract. You just have to spend a few hours reading ALL the docs. It's well worth the effort.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?