I've got a hundred 128 x 128 .pgm files with some shapes on them and I think their color scale is 255 (not sure on this one though, so it'd be nice if a solution could also take that in consideration) and I need to extract these colors to process the images. So what I'd like to end up with would be a 128 x 128 matrix with each element having a value between 0 - 255, assuming the 256 colors example.
As for the language, anything in Python/Java/C# will do, preferably in that order. I can use either Windows or Linux so exclusive libraries are not an issue.