Helper functions for PBM/PGM/PPM image file formats
