home *** CD-ROM | disk | FTP | other *** search
-
-
-
- pgm(5) PBM Plus pgm(5)
-
-
-
- NAME
- pgm - portable graymap file format
-
- DESCRIPTION
- The portable graymap format is a lowest common denominator
- grayscale file format. The definition is as follows:
-
- - A "magic number" for identifying the file type. A pgm
- file's magic number is the two characters "P2".
-
- - Whitespace (blanks, TABs, CRs, LFs).
-
- - A width, formatted as ASCII characters in decimal.
-
- - Whitespace.
-
- - A height, again in ASCII decimal.
-
- - Whitespace.
-
- - The maximum gray value, again in ASCII decimal.
-
- - Whitespace.
-
- - Width * height gray values, each in ASCII decimal, between
- 0 and the specified maximum value, separated by whi-
- tespace, starting at the top-left corner of the graymap,
- proceding in normal English reading order. A value of 0
- means black, and the maximum value means white.
-
- - Characters from a "#" to the next end-of-line are ignored
- (comments).
-
- - No line should be longer than 70 characters.
-
- Here is an example of a small graymap in this format:
-
- P2
- # feep.pgm
- 18 7
- 15
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 3 3 3 3 0 0 7 7 7 7 0 0 11 11 11 11 0
- 0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0
- 0 3 3 3 0 0 0 7 7 7 0 0 0 11 11 11 0 0
- 0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0
- 0 3 0 0 0 0 0 7 7 7 7 0 0 11 11 11 11 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-
- Programs that read this format should be as lenient as pos-
- sible, accepting anything that looks remotely like a gray-
- map.
-
-
-
- Printed 5/25/90 01 August 1989 1
-
-
-
-
-
-
- pgm(5) PBM Plus pgm(5)
-
-
-
- There is also a variant on the format, available by setting
- the RAWBITS option at compile time. This variant is dif-
- ferent in the following ways:
-
- - The "magic number" is "P5" instead of "P2".
-
- - The gray values are stored as plain bytes, instead of
- ASCII decimal.
-
- - No whitespace is allowed in the grays section.
-
- - The files are smaller and many times faster to read and
- write.
-
- Note that this raw format can only be used for maxvals less
- than or equal to 255. If you use the PGM library and try to
- write a file with a larger maxval, it will automatically
- fall back on the slower but more general ASCII format.
-
- SEE ALSO
- fitstopgm(1), fstopgm(1), hipstopgm(1), psidtopgm(1),
- rawtopgm(1), tifftopgm(1), pgmenhance(1), pgmhist(1),
- pgmnorm(1), pgmtofits(1), pgmtopbm(1), pgmtops(1), pnm(5),
- pbm(5), ppm(5)
-
- AUTHOR
- Copyright (C) 1989 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 docu-
- mentation. This software is provided "as is" without
- express or implied warranty.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Printed 5/25/90 01 August 1989 2
-
-
-
-