home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / formats / pbm / spec / pgm.txt < prev    next >
Text File  |  1994-06-01  |  4KB  |  133 lines

  1.  
  2.  
  3.  
  4.      pgm(5)              AMIGA (12 November 1991)               pgm(5)
  5.  
  6.  
  7.  
  8.      NAME
  9.           pgm - portable graymap file format
  10.  
  11.      DESCRIPTION
  12.           The portable graymap format is a lowest common denominator
  13.           grayscale file format.  The definition is as follows:
  14.  
  15.           - A "magic number" for identifying the file type.  A pgm
  16.             file's magic number is the two characters "P2".
  17.  
  18.           - Whitespace (blanks, TABs, CRs, LFs).
  19.  
  20.           - A width, formatted as ASCII characters in decimal.
  21.  
  22.           - Whitespace.
  23.  
  24.           - A height, again in ASCII decimal.
  25.  
  26.           - Whitespace.
  27.  
  28.           - The maximum gray value, again in ASCII decimal.
  29.  
  30.           - Whitespace.
  31.  
  32.           - Width * height gray values, each in ASCII decimal, between
  33.             0 and the specified maximum value, separated by
  34.             whitespace, starting at the top-left corner of the
  35.             graymap, proceeding in normal English reading order.  A
  36.             value of 0 means black, and the maximum value means white.
  37.  
  38.           - Characters from a "#" to the next end-of-line are ignored
  39.             (comments).
  40.  
  41.           - No line should be longer than 70 characters.
  42.  
  43.           Here is an example of a small graymap in this format:
  44.           P2
  45.           # feep.pgm
  46.           24 7
  47.           15
  48.           0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
  49.           0  3  3  3  3  0  0  7  7  7  7  0  0 11 11 11 11  0  0 15 15 15 15  0
  50.           0  3  0  0  0  0  0  7  0  0  0  0  0 11  0  0  0  0  0 15  0  0 15  0
  51.           0  3  3  3  0  0  0  7  7  7  0  0  0 11 11 11  0  0  0 15 15 15 15  0
  52.           0  3  0  0  0  0  0  7  0  0  0  0  0 11  0  0  0  0  0 15  0  0  0  0
  53.           0  3  0  0  0  0  0  7  7  7  7  0  0 11 11 11 11  0  0 15  0  0  0  0
  54.           0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
  55.  
  56.           Programs that read this format should be as lenient as
  57.           possible, accepting anything that looks remotely like a
  58.           graymap.
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 1/30/92)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      pgm(5)              AMIGA (12 November 1991)               pgm(5)
  71.  
  72.  
  73.  
  74.           There is also a variant on the format, available by setting
  75.           the RAWBITS option at compile time.  This variant is
  76.           different in the following ways:
  77.  
  78.           - The "magic number" is "P5" instead of "P2".
  79.  
  80.           - The gray values are stored as plain bytes, instead of
  81.             ASCII decimal.
  82.  
  83.           - No whitespace is allowed in the grays section, and only a
  84.             single character of whitespace (typically a newline) is
  85.             allowed after the maxval.
  86.  
  87.           - The files are smaller and many times faster to read and
  88.             write.
  89.  
  90.           Note that this raw format can only be used for maxvals less
  91.           than or equal to 255.  If you use the pgm library and try to
  92.           write a file with a larger maxval, it will automatically
  93.           fall back on the slower but more general plain format.
  94.  
  95.      SEE ALSO
  96.           fitstopgm(1), fstopgm(1), hipstopgm(1), lispmtopgm(1),
  97.           psidtopgm(1), rawtopgm(1), pgmbentley(1), pgmcrater(1),
  98.           pgmedge(1), pgmenhance(1), pgmhist(1), pgmnorm(1),
  99.           pgmoil(1), pgmramp(1), pgmtexture(1), pgmtofits(1),
  100.           pgmtofs(1), pgmtolispm(1), pgmtopbm(1), pnm(5), pbm(5),
  101.           ppm(5)
  102.  
  103.      AUTHOR
  104.           Copyright (C) 1989, 1991 by Jef Poskanzer.
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 1/30/92)
  130.  
  131.  
  132.  
  133.