A library and a bunch of programs to save netpbm files.
Save anything (using stb_image) to PAM (P7) format.
Save anything (using stb_image) to PBM (P4) format.
Save anything (using stb_image) to PPM (P5 or P6) format.
Can be 1 (grayscale) or 3 (rgb) channels.
bool ppmSave(unsigned int sizex, unsigned int sizey, unsigned int channels, unsigned char *buf, FILE *f);
Can be 1 (grayscale), 2 (grayscale+alpha), 3 (rbg) or 4 (rgba) channels.
bool pamSave(unsigned int sizex, unsigned int sizey, unsigned int channels, unsigned char *buf, FILE *f);
bool pbmSave(unsigned int sizex, unsigned int sizey, unsigned char *buf, FILE *f);