This program is part of Netpbm.
rasttopnm reads a Sun rasterfile as input and produces a PNM image as output. The type of the output file depends on the input file - if it's black and white, rasttopnm writes a PBM image. If it's grayscale, rasttopnm writes a PGM. If it's color, rasttopnm writes a PPM. The program tells you which type it is generating.