pgm

portable graymap file format

(from the PBMplus library by Jef Poskanzer - modified for the POTM)

The portable graymap format is a lowest common denominator grayscale file format.

The definition is as follows:

Characters from a "#" to the next end-of-line are ignored (comments). Note that the POTM uses the comment line to pass in the value of LIMIT for this particular porblem.

No line should be longer than 70 characters.

Here is an example of a small graymap in this format:

P2
# 50 (note that ordinarily this is an arbitrary comment)
7 7
255
10 254 7 0 0 0 13 20 254 7 10 0 180 13 30 254 7 40 0 180 13
40 254 7 60 0 74 13 50 254 7 220 0 0 13
60 254 7 0 70 0 13 70 254 7 0 110 0 100
Programs that read this format should be as lenient as possible, accepting anything that looks remotely like a graymap.


Copyright (C) 1989, 1991 by Jef Poskanzer. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. This software is provided "as is" without expressed or implied warranty.