in reply to Pixel by pixel reading of images

Chmrr is correct. To get html usable color codes out add:
my $color = sprintf "%02x%02x%02x", $r, $g, $b;
This will create the 3 sets of 2 digit hex numbers you are looking for.

I did an image to table converter here (colored cells)
I believe there are a few other progs like this here, try the code vault.

Snowcrash seems to have built(or used) something similar to what you are doing, but i'm not sure where his code is.