This is a lightweight and fast library for reading and writing any PNM file - PBM, PGM and PPM, up to 16 bits per sample, in ascii/binary format. Library contains also a Python bindings - module pixfiles with PixFile class.
Read single-band NASA PDS (Planetary Data System) Image files in Python. Query header information and extract binary image data in a format suitable for PIL (Python Imaging Library). Works for Pathfinder and Mars Exploration Rover images, maybe others.