7 * Returns number of color channels (1 == grayscale, 3 == rgb)
10 extern int read_pnm_header (char *fname
, int *w
, int *h
);
13 * Read pnm into buf. Assumes you have called read_pnm_header()
14 * and allocated buf before.
16 extern int read_pnm (char *fname
, uint8_t *buf
);
19 * Write buf into pnm file. Depending of the suffix of fname we
20 * assume 1 channel for '.png' and 3 channels for '.ppm'
22 extern void write_pnm (char *fname
, uint8_t *buf
, int w
, int h
);
25 * Write a int16_t buf into pgm file
27 extern void write_pgm16 (char *fname
, int16_t *buf
, int w
, int h
, int16_t offset
);