1User manual for old pgm funcLtiibornasr(y3)FunctionUsseMranmuaanlual for old pgm functions(3)
2
3
4

NAME

6       libpgm - libnetpbm functions to read and write PGM image files
7
8

SYNOPSIS

10       #include <netpbm/pgm.h>
11
12       void pgm_init( int *argcP, char *argv[] );
13
14       gray ** pgm_allocarray( int cols, int rows );
15
16       gray * pgm_allocrow( intcols );
17
18       void pgm_freearray( gray **grays, introws );
19
20       void pgm_freerow( gray *grayrow);
21
22       void  pgm_readpgminit( FILE *fp, int *colsP, int *rowsP, gray *maxvalP,
23       int *formatP );
24
25       void pgm_readpgmrow( FILE *fp, gray *grayrow, int  cols,  gray  maxval,
26       int format );
27
28       gray ** pgm_readpgm( FILE *fp, int *colsP, int *rowsP, gray *maxvalP );
29
30       void  pgm_writepgminit(  FILE  *  fp , int cols, int rows, gray maxval,
31       int forceplain );
32
33       void pgm_writepgmrow( FILE *fp, gray *grayrow, int cols,  gray  maxval,
34       int forceplain );
35
36       void  pgm_writepgm(  FILE  *fp, gray ** grays, int cols, int rows, gray
37       maxval, int forceplain );
38
39       void pgm_writepgm( FILE *fp, gray **grays, int  cols,  int  rows,  gray
40       maxval, int forceplain );
41
42       void pgm_nextimage( FILE *file, int * const eofP);
43
44       void pgm_check( FILE * file, const enum pm_check_type check_type, const
45       int format, const int cols, const int  rows,  const  int  maxval,  enum
46       pm_check_code * const retval);
47
48       typedef ... gray;
49
50       #define PGM_MAXMAXVAL ...
51
52       #define PGM_OVERALLMAXVAL ...
53
54       #define PGM_FORMAT ...
55
56       #define RPGM_FORMAT ...
57
58       #define PGM_TYPE PGM_FORMAT
59
60       #define
61
62       PGM_FORMAT_TYPE(format) ...
63
64

DESCRIPTION

66       These library functions are part of Netpbm(1).
67
68
69   TYPES AND CONSTANTS
70       Each  gray should contain only the values between 0 and PGM_OVERALLMAX‐
71       VAL.
72
73       PGM_OVERALLMAXVAL is the maximum value of  a  maxval  in  a  PGM  file.
74       PGM_MAXMAXVAL  is  the  maximum value of a maxval in a PGM file that is
75       compatible with the PGM format as it existed before April 2000.  It  is
76       also the maximum value of a maxval that results in the minimum possible
77       raster size for a particular image.  I.e an image with a maxval  higher
78       than  PGM_MAXMAXVAL  cannot  be read or generated by old PGM processing
79       programs and requires more file space.
80
81       PGM_FORMAT  is the format code for  a  Plain  PGM  format  image  file.
82       RPGM_FORMAT  is  the  format  code  for  a  Raw  PGM format image file.
83       PGM_TYPE  is the format type code for the PGM formats.  PGM_FORMAT_TYPE
84       is a macro that generates code to compute the format type code of a PBM
85       or PGM format from the format code which is its argument.
86
87
88   INITIALIZATION
89       pgm_init() is identical to pm_proginit.
90
91       pgm_init() is obsolete.  Use pm_proginit() instead.
92
93
94   MEMORY MANAGEMENT
95       pgm_allocarray() allocates an array of grays.
96
97       pgm_allocrow() allocates a row of the given number of grays.
98
99       pgm_freearray() frees the array allocated  with  pgm_allocarray()  con‐
100       taining the given number of rows.
101
102       pgm_freerow() frees a row of grays allocated with pgm_allocrow().
103
104
105   READING FILES
106       If a function in this section is called on a PBM format file, it trans‐
107       lates the PBM file into a PGM file on the fly and functions  as  if  it
108       were  called  on the equivalent PGM file.  The format value returned by
109       pgm_readpgminit() is,  however,  not  translated.   It  represents  the
110       actual format of the PBM file.
111
112       pgm_readpgminit()  reads  the  header  of a PGM file, returning all the
113       information from the header and leaving the file positioned just  after
114       the header.
115
116       pgm_readpgmrow() reads a row of grays into the grayrow
117        array.    format,  cols,  and  maxval   are  the  values  returned  by
118       pgm_readpgminit().
119
120       pgm_readpgm() reads an entire PGM  image  into  memory,  returning  the
121       allocated  array as its return value and returning the information from
122       the  header  as  rows,  cols,  and  maxval.   This  function   combines
123       pgm_readpgminit(), pgm_allocarray(), and pgm_readpgmrow().
124
125       pgm_readpgminit()  and  pgm_readpgm abort the program with a message to
126       Standard Error if the PGM image  header  is  not  syntactically  valid,
127       including  if  it contains a number too large to be processed using the
128       system's normal data structures (to wit, a number that won't fit in a C
129       'int').
130
131
132
133   WRITING FILES
134       pgm_writepgminit() writes the header for a PGM file and leaves it posi‐
135       tioned just after the header.
136
137       forceplain is a logical value that tells pgm_writepgminit()  to write a
138       header  for  a  plain  PGM  format file, as opposed to a raw PGM format
139       file.
140
141       pgm_writepgmrow() writes the row grayrow to a PGM file.  For meaningful
142       results, cols, maxval, and forceplain must be the same as was used with
143       pgm_writepgminit().
144
145       pgm_writepgm() write the header and all data for  a  PGM  image.   This
146       function combines pgm_writepgminit() and pgm_writepgmrow().
147
148
149   MISCELLANEOUS
150       pgm_nextimage()  positions a PGM input file to the next image in it (so
151       that a subsequent pgm_readpgminit() reads its header).
152
153       pgm_nextimage() is analogous to pbm_nextimage(), but works on  PGM  and
154       PBM files.
155
156       pgm_check()   checks for the common file integrity error where the file
157       is the wrong size to contain all the image data.
158
159       pgm_check()  is analogous to pbm_check(), but  works  on  PGM  and  PBM
160       files.
161
162

SEE ALSO

164       libpbm(1), libppm(1), libpnm(1)
165
166
167
168netpbm documentation           8 SeptemberU2s0e0r7manual for old pgm functions(3)
Impressum