adding functor to PNMReader and split PNM into PGM/PPM