home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / NETWORK / netpbm_docs.lzh / NETPBM / DOCS / pgm.5 < prev    next >
Text File  |  1996-11-18  |  3KB  |  91 lines

  1. .TH pgm 5 "12 November 1991"
  2. .SH NAME
  3. pgm - portable graymap file format
  4. .SH DESCRIPTION
  5. The portable graymap format is a lowest common denominator grayscale
  6. file format.
  7. .IX "PGM file format"
  8. The definition is as follows:
  9. .IP - 2
  10. A "magic number" for identifying the file type.
  11. A pgm file's magic number is the two characters "P2".
  12. .IX "magic numbers"
  13. .IP - 2
  14. Whitespace (blanks, TABs, CRs, LFs).
  15. .IP - 2
  16. A width, formatted as ASCII characters in decimal.
  17. .IP - 2
  18. Whitespace.
  19. .IP - 2
  20. A height, again in ASCII decimal.
  21. .IP - 2
  22. Whitespace.
  23. .IP - 2
  24. The maximum gray value, again in ASCII decimal.
  25. .IP - 2
  26. Whitespace.
  27. .IP - 2
  28. Width * height gray values, each in ASCII decimal, between 0 and the specified
  29. maximum value, separated by whitespace, starting at the top-left
  30. corner of the graymap, proceeding in normal English reading order.
  31. A value of 0 means black, and the maximum value means white.
  32. .IP - 2
  33. Characters from a "#" to the next end-of-line are ignored (comments).
  34. .IP - 2
  35. No line should be longer than 70 characters.
  36. .PP
  37. Here is an example of a small graymap in this format:
  38. .nf
  39. P2
  40. # feep.pgm
  41. 24 7
  42. 15
  43. 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
  44. 0  3  3  3  3  0  0  7  7  7  7  0  0 11 11 11 11  0  0 15 15 15 15  0
  45. 0  3  0  0  0  0  0  7  0  0  0  0  0 11  0  0  0  0  0 15  0  0 15  0
  46. 0  3  3  3  0  0  0  7  7  7  0  0  0 11 11 11  0  0  0 15 15 15 15  0
  47. 0  3  0  0  0  0  0  7  0  0  0  0  0 11  0  0  0  0  0 15  0  0  0  0
  48. 0  3  0  0  0  0  0  7  7  7  7  0  0 11 11 11 11  0  0 15  0  0  0  0
  49. 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
  50. .fi
  51. .PP
  52. Programs that read this format should be as lenient as possible,
  53. accepting anything that looks remotely like a graymap.
  54. .PP
  55. There is also a variant on the format, available
  56. by setting the RAWBITS option at compile time.  This variant is
  57. different in the following ways:
  58. .IX RAWBITS
  59. .IP - 2
  60. The "magic number" is "P5" instead of "P2".
  61. .IP - 2
  62. The gray values are stored as plain bytes, instead of ASCII decimal.
  63. .IP - 2
  64. No whitespace is allowed in the grays section, and only a single character
  65. of whitespace (typically a newline) is allowed after the maxval.
  66. .IP - 2
  67. The files are smaller and many times faster to read and write.
  68. .PP
  69. Note that this raw format can only be used for maxvals less than
  70. or equal to 255.
  71. If you use the
  72. .I pgm
  73. library and try to write a file with a larger maxval,
  74. it will automatically fall back on the slower but more general plain
  75. format.
  76. .SH "SEE ALSO"
  77. fitstopgm(1), fstopgm(1), hipstopgm(1), lispmtopgm(1), psidtopgm(1),
  78. rawtopgm(1),
  79. pgmbentley(1), pgmcrater(1), pgmedge(1), pgmenhance(1), pgmhist(1), pgmnorm(1),
  80. pgmoil(1), pgmramp(1), pgmtexture(1),
  81. pgmtofits(1), pgmtofs(1), pgmtolispm(1), pgmtopbm(1),
  82. pnm(5), pbm(5), ppm(5)
  83. .SH AUTHOR
  84. Copyright (C) 1989, 1991 by Jef Poskanzer.
  85. .\" Permission to use, copy, modify, and distribute this software and its
  86. .\" documentation for any purpose and without fee is hereby granted, provided
  87. .\" that the above copyright notice appear in all copies and that both that
  88. .\" copyright notice and this permission notice appear in supporting
  89. .\" documentation.  This software is provided "as is" without express or
  90. .\" implied warranty.
  91.