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. | [reply] |
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:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
| [reply] [d/l] |