119 #include <config_auto.h>
124 #include "allheaders.h"
136 static const l_int32 MAX_PNM_WIDTH = 100000;
137 static const l_int32 MAX_PNM_HEIGHT = 100000;
152 l_uint8 val8, rval8, gval8, bval8, aval8, mask8;
153 l_uint16 val16, rval16, gval16, bval16, aval16;
154 l_int32 w, h, d, bps, spp, bpl, wpl, i, j, type;
155 l_int32 val, rval, gval, bval;
157 l_uint32 *line, *data;
161 return (
PIX *)ERROR_PTR(
"fp not defined", __func__, NULL);
164 return (
PIX *)ERROR_PTR(
"header read failed", __func__, NULL);
165 if (bps < 1 || bps > 16)
166 return (
PIX *)ERROR_PTR(
"invalid bps", __func__, NULL);
167 if (spp < 1 || spp > 4)
168 return (
PIX *)ERROR_PTR(
"invalid spp", __func__, NULL);
170 return (
PIX *)ERROR_PTR(
"pix not made", __func__, NULL);
171 pixSetInputFormat(pix, IFF_PNM);
173 wpl = pixGetWpl(pix);
177 if (type == 6 && bps == 16)
184 for (i = 0; i < h; i++) {
185 for (j = 0; j < w; j++) {
188 return (
PIX *)ERROR_PTR(
"read abend", __func__, NULL);
197 for (i = 0; i < h; i++) {
198 for (j = 0; j < w; j++) {
201 return (
PIX *)ERROR_PTR(
"read abend", __func__, NULL);
205 return (
PIX *)ERROR_PTR(
"read abend", __func__, NULL);
209 return (
PIX *)ERROR_PTR(
"read abend", __func__, NULL);
219 bpl = (d * w + 7) / 8;
220 for (i = 0; i < h; i++) {
221 line = data + i * wpl;
222 for (j = 0; j < bpl; j++) {
223 if (fread(&val8, 1, 1, fp) != 1) {
225 return (
PIX *)ERROR_PTR(
"read error in 4", __func__, NULL);
234 for (i = 0; i < h; i++) {
235 line = data + i * wpl;
237 for (j = 0; j < w; j++) {
238 if (fread(&val8, 1, 1, fp) != 1) {
240 return (
PIX *)ERROR_PTR(
"error in 5", __func__, NULL);
250 for (j = 0; j < w; j++) {
251 if (fread(&val16, 2, 1, fp) != 1) {
253 return (
PIX *)ERROR_PTR(
"16 bpp error", __func__, NULL);
263 for (i = 0; i < h; i++) {
264 line = data + i * wpl;
265 for (j = 0; j < wpl; j++) {
266 if (fread(&rval8, 1, 1, fp) != 1) {
268 return (
PIX *)ERROR_PTR(
"read error type 6",
271 if (fread(&gval8, 1, 1, fp) != 1) {
273 return (
PIX *)ERROR_PTR(
"read error type 6",
276 if (fread(&bval8, 1, 1, fp) != 1) {
278 return (
PIX *)ERROR_PTR(
"read error type 6",
290 mask8 = (1 << bps) - 1;
293 for (i = 0; i < h; i++) {
294 for (j = 0; j < w; j++) {
295 if (fread(&val8, 1, 1, fp) != 1) {
297 return (
PIX *)ERROR_PTR(
"read error type 7",
301 if (bps == 1) val8 ^= 1;
308 for (i = 0; i < h; i++) {
309 for (j = 0; j < w; j++) {
310 if (fread(&val8, 1, 1, fp) != 1) {
312 return (
PIX *)ERROR_PTR(
"read error type 7",
315 if (fread(&aval8, 1, 1, fp) != 1) {
317 return (
PIX *)ERROR_PTR(
"read error type 7",
321 aval8 = aval8 & mask8;
330 for (i = 0; i < h; i++) {
331 line = data + i * wpl;
332 for (j = 0; j < wpl; j++) {
333 if (fread(&rval8, 1, 1, fp) != 1) {
335 return (
PIX *)ERROR_PTR(
"read error type 7",
338 if (fread(&gval8, 1, 1, fp) != 1) {
340 return (
PIX *)ERROR_PTR(
"read error type 7",
343 if (fread(&bval8, 1, 1, fp) != 1) {
345 return (
PIX *)ERROR_PTR(
"read error type 7",
348 rval8 = rval8 & mask8;
349 gval8 = gval8 & mask8;
350 bval8 = bval8 & mask8;
358 for (i = 0; i < h; i++) {
359 line = data + i * wpl;
360 for (j = 0; j < wpl; j++) {
361 if (fread(&rval8, 1, 1, fp) != 1) {
363 return (
PIX *)ERROR_PTR(
"read error type 7",
366 if (fread(&gval8, 1, 1, fp) != 1) {
368 return (
PIX *)ERROR_PTR(
"read error type 7",
371 if (fread(&bval8, 1, 1, fp) != 1) {
373 return (
PIX *)ERROR_PTR(
"read error type 7",
376 if (fread(&aval8, 1, 1, fp) != 1) {
378 return (
PIX *)ERROR_PTR(
"read error type 7",
381 rval8 = rval8 & mask8;
382 gval8 = gval8 & mask8;
383 bval8 = bval8 & mask8;
384 aval8 = aval8 & mask8;
400 for (i = 0; i < h; i++) {
401 for (j = 0; j < w; j++) {
402 if (fread(&val16, 2, 1, fp) != 1) {
404 return (
PIX *)ERROR_PTR(
"read error type 7",
414 for (i = 0; i < h; i++) {
415 for (j = 0; j < w; j++) {
416 if (fread(&val16, 2, 1, fp) != 1) {
418 return (
PIX *)ERROR_PTR(
"read error type 7",
421 if (fread(&aval16, 2, 1, fp) != 1) {
423 return (
PIX *)ERROR_PTR(
"read error type 7",
427 aval8 = aval16 & 0xff;
436 for (i = 0; i < h; i++) {
437 line = data + i * wpl;
438 for (j = 0; j < wpl; j++) {
439 if (fread(&rval16, 2, 1, fp) != 1) {
441 return (
PIX *)ERROR_PTR(
"read error type 7",
444 if (fread(&gval16, 2, 1, fp) != 1) {
446 return (
PIX *)ERROR_PTR(
"read error type 7",
449 if (fread(&bval16, 2, 1, fp) != 1) {
451 return (
PIX *)ERROR_PTR(
"read error type 7",
454 rval8 = rval16 & 0xff;
455 gval8 = gval16 & 0xff;
456 bval8 = bval16 & 0xff;
464 for (i = 0; i < h; i++) {
465 line = data + i * wpl;
466 for (j = 0; j < wpl; j++) {
467 if (fread(&rval16, 2, 1, fp) != 1) {
469 return (
PIX *)ERROR_PTR(
"read error type 7",
472 if (fread(&gval16, 2, 1, fp) != 1) {
474 return (
PIX *)ERROR_PTR(
"read error type 7",
477 if (fread(&bval16, 2, 1, fp) != 1) {
479 return (
PIX *)ERROR_PTR(
"read error type 7",
482 if (fread(&aval16, 2, 1, fp) != 1) {
484 return (
PIX *)ERROR_PTR(
"read error type 7",
487 rval8 = rval16 & 0xff;
488 gval8 = gval16 & 0xff;
489 bval8 = bval16 & 0xff;
490 aval8 = aval16 & 0xff;
532 if (ptype) *ptype = 0;
536 return ERROR_INT(
"filename not defined", __func__, 1);
539 return ERROR_INT(
"image file not found", __func__, 1);
567 char tag[16], tupltype[32];
568 l_int32 i, w, h, d, bps, spp, type;
575 if (ptype) *ptype = 0;
579 return ERROR_INT(
"fp not defined", __func__, 1);
581 if (fscanf(fp,
"P%d\n", &type) != 1)
582 return ERROR_INT(
"invalid read for type", __func__, 1);
583 if (type < 1 || type > 7)
584 return ERROR_INT(
"invalid pnm file", __func__, 1);
587 return ERROR_INT(
"no data in file", __func__, 1);
590 w = h = d = bps = spp = maxval = 0;
591 for (i = 0; i < 10; i++) {
593 return ERROR_INT(
"found no next tag", __func__, 1);
594 if (!strcmp(tag,
"WIDTH")) {
596 return ERROR_INT(
"failed reading width", __func__, 1);
599 if (!strcmp(tag,
"HEIGHT")) {
601 return ERROR_INT(
"failed reading height", __func__, 1);
604 if (!strcmp(tag,
"DEPTH")) {
606 return ERROR_INT(
"failed reading depth", __func__, 1);
609 if (!strcmp(tag,
"MAXVAL")) {
611 return ERROR_INT(
"failed reading maxval", __func__, 1);
614 if (!strcmp(tag,
"TUPLTYPE")) {
616 return ERROR_INT(
"failed reading tuple type", __func__, 1);
619 if (!strcmp(tag,
"ENDHDR")) {
620 if (
'\n' != (ch = fgetc(fp)))
621 return ERROR_INT(
"missing LF after ENDHDR", __func__, 1);
625 if (w <= 0 || h <= 0 || w > MAX_PNM_WIDTH || h > MAX_PNM_HEIGHT) {
626 L_INFO(
"invalid size: w = %d, h = %d\n", __func__, w, h);
631 }
else if (maxval == 3) {
633 }
else if (maxval == 15) {
635 }
else if (maxval == 255) {
637 }
else if (maxval == 0xffff) {
640 L_INFO(
"invalid maxval = %d\n", __func__, maxval);
654 L_INFO(
"invalid depth = %d\n", __func__, spp);
659 if (fscanf(fp,
"%d %d\n", &w, &h) != 2)
660 return ERROR_INT(
"invalid read for w,h", __func__, 1);
661 if (w <= 0 || h <= 0 || w > MAX_PNM_WIDTH || h > MAX_PNM_HEIGHT) {
662 L_INFO(
"invalid size: w = %d, h = %d\n", __func__, w, h);
675 if (type == 1 || type == 4) {
679 }
else if (type == 2 || type == 5) {
681 return ERROR_INT(
"invalid read for maxval (2,5)", __func__, 1);
684 }
else if (maxval == 15) {
686 }
else if (maxval == 255) {
688 }
else if (maxval == 0xffff) {
692 return ERROR_INT(
"invalid maxval", __func__, 1);
698 return ERROR_INT(
"invalid read for maxval (3,6)", __func__, 1);
699 if (maxval != 255 && maxval != 0xffff) {
700 L_ERROR(
"unexpected maxval = %d\n", __func__, maxval);
703 bps = (maxval == 255) ? 8 : 16;
711 if (ptype) *ptype = type;
712 if (pbps) *pbps = bps;
713 if (pspp) *pspp = spp;
742 l_int32 h, w, d, ds, i, j, wpls, bpl, filebpl, writeerror, maxval;
743 l_uint32 *pword, *datas, *lines;
747 return ERROR_INT(
"fp not defined", __func__, 1);
749 return ERROR_INT(
"pix not defined", __func__, 1);
752 if (d != 1 && d != 2 && d != 4 && d != 8 && d != 16 && d != 24 && d != 32)
753 return ERROR_INT(
"d not in {1,2,4,8,16,24,32}", __func__, 1);
754 if (d == 32 && pixGetSpp(pix) == 4)
758 if (pixGetColormap(pix) != NULL)
762 ds = pixGetDepth(pixs);
764 wpls = pixGetWpl(pixs);
769 fprintf(fp,
"P4\n# Raw PBM file written by leptonica "
770 "(www.leptonica.com)\n%d %d\n", w, h);
773 for (i = 0; i < h; i++) {
774 lines = datas + i * wpls;
775 for (j = 0; j < bpl; j++) {
777 fwrite(&val8, 1, 1, fp);
780 }
else if (ds == 2 || ds == 4 || ds == 8 || ds == 16) {
781 maxval = (1 << ds) - 1;
782 fprintf(fp,
"P5\n# Raw PGM file written by leptonica "
783 "(www.leptonica.com)\n%d %d\n%d\n", w, h, maxval);
786 for (i = 0; i < h; i++) {
787 lines = datas + i * wpls;
788 for (j = 0; j < w; j++) {
795 fwrite(&val8, 1, 1, fp);
799 for (i = 0; i < h; i++) {
800 lines = datas + i * wpls;
801 for (j = 0; j < w; j++) {
803 fwrite(&val16, 2, 1, fp);
808 fprintf(fp,
"P6\n# Raw PPM file written by leptonica "
809 "(www.leptonica.com)\n%d %d\n255\n", w, h);
813 for (i = 0; i < h; i++) {
814 lines = datas + i * wpls;
815 if (fwrite(lines, 1, filebpl, fp) != filebpl)
819 for (i = 0; i < h; i++) {
820 lines = datas + i * wpls;
821 for (j = 0; j < wpls; j++) {
826 if (fwrite(pel, 1, 3, fp) != 3)
835 return ERROR_INT(
"image write fail", __func__, 1);
858 l_int32 h, w, d, ds, i, j, k, maxval, count;
863 return ERROR_INT(
"fp not defined", __func__, 1);
865 return ERROR_INT(
"pix not defined", __func__, 1);
868 if (d != 1 && d != 2 && d != 4 && d != 8 && d != 16 && d != 32)
869 return ERROR_INT(
"d not in {1,2,4,8,16,32}", __func__, 1);
872 if (pixGetColormap(pix) != NULL)
876 ds = pixGetDepth(pixs);
879 fprintf(fp,
"P1\n# Ascii PBM file written by leptonica "
880 "(www.leptonica.com)\n%d %d\n", w, h);
883 for (i = 0; i < h; i++) {
884 for (j = 0; j < w; j++) {
898 }
else if (ds == 2 || ds == 4 || ds == 8 || ds == 16) {
899 maxval = (1 << ds) - 1;
900 fprintf(fp,
"P2\n# Ascii PGM file written by leptonica "
901 "(www.leptonica.com)\n%d %d\n%d\n", w, h, maxval);
904 for (i = 0; i < h; i++) {
905 for (j = 0; j < w; j++) {
908 snprintf(buffer,
sizeof(buffer),
"%1d ", val);
909 fwrite(buffer, 1, 2, fp);
911 }
else if (ds == 4) {
912 snprintf(buffer,
sizeof(buffer),
"%2d ", val);
913 fwrite(buffer, 1, 3, fp);
915 }
else if (ds == 8) {
916 snprintf(buffer,
sizeof(buffer),
"%3d ", val);
917 fwrite(buffer, 1, 4, fp);
920 snprintf(buffer,
sizeof(buffer),
"%5d ", val);
921 fwrite(buffer, 1, 6, fp);
931 fprintf(fp,
"P3\n# Ascii PPM file written by leptonica "
932 "(www.leptonica.com)\n%d %d\n255\n", w, h);
934 for (i = 0; i < h; i++) {
935 for (j = 0; j < w; j++) {
940 for (k = 0; k < 3; k++) {
941 snprintf(buffer,
sizeof(buffer),
"%3d ", cval[k]);
942 fwrite(buffer, 1, 4, fp);
979 l_int32 h, w, d, ds, i, j;
980 l_int32 wpls, spps, filebpl, writeerror, maxval;
981 l_uint32 *pword, *datas, *lines;
985 return ERROR_INT(
"fp not defined", __func__, 1);
987 return ERROR_INT(
"pix not defined", __func__, 1);
990 if (d != 1 && d != 2 && d != 4 && d != 8 && d != 16 && d != 24 && d != 32)
991 return ERROR_INT(
"d not in {1,2,4,8,16,24,32}", __func__, 1);
994 if (pixGetColormap(pix) != NULL)
998 ds = pixGetDepth(pixs);
1000 wpls = pixGetWpl(pixs);
1001 spps = pixGetSpp(pixs);
1003 maxval = (1 << ds) - 1;
1008 fprintf(fp,
"P7\n# Arbitrary PAM file written by leptonica "
1009 "(www.leptonica.com)\n");
1010 fprintf(fp,
"WIDTH %d\n", w);
1011 fprintf(fp,
"HEIGHT %d\n", h);
1012 fprintf(fp,
"DEPTH %d\n", spps);
1013 fprintf(fp,
"MAXVAL %d\n", maxval);
1014 if (spps == 1 && ds == 1)
1015 fprintf(fp,
"TUPLTYPE BLACKANDWHITE\n");
1017 fprintf(fp,
"TUPLTYPE GRAYSCALE\n");
1019 fprintf(fp,
"TUPLTYPE RGB\n");
1021 fprintf(fp,
"TUPLTYPE RGB_ALPHA\n");
1022 fprintf(fp,
"ENDHDR\n");
1026 for (i = 0; i < h; i++) {
1027 lines = datas + i * wpls;
1028 for (j = 0; j < w; j++) {
1031 if (fwrite(&val8, 1, 1, fp) != 1)
1038 for (i = 0; i < h; i++) {
1039 lines = datas + i * wpls;
1040 for (j = 0; j < w; j++) {
1042 if (fwrite(&val8, 1, 1, fp) != 1)
1049 for (i = 0; i < h; i++) {
1050 lines = datas + i * wpls;
1051 for (j = 0; j < w; j++) {
1053 if (fwrite(&val8, 1, 1, fp) != 1)
1060 for (i = 0; i < h; i++) {
1061 lines = datas + i * wpls;
1062 for (j = 0; j < w; j++) {
1064 if (fwrite(&val8, 1, 1, fp) != 1)
1071 for (i = 0; i < h; i++) {
1072 lines = datas + i * wpls;
1073 for (j = 0; j < w; j++) {
1075 if (fwrite(&val16, 2, 1, fp) != 1)
1083 for (i = 0; i < h; i++) {
1084 lines = datas + i * wpls;
1085 if (fwrite(lines, 1, filebpl, fp) != filebpl)
1093 for (i = 0; i < h; i++) {
1094 lines = datas + i * wpls;
1095 for (j = 0; j < wpls; j++) {
1100 if (fwrite(pel, 1, 3, fp) != 3)
1106 for (i = 0; i < h; i++) {
1107 lines = datas + i * wpls;
1108 for (j = 0; j < wpls; j++) {
1114 if (fwrite(pel, 1, 4, fp) != 4)
1125 return ERROR_INT(
"image write fail", __func__, 1);
1154 return (
PIX *)ERROR_PTR(
"data not defined", __func__, NULL);
1156 return (
PIX *)ERROR_PTR(
"stream not opened", __func__, NULL);
1159 if (!pix) L_ERROR(
"pix not read\n", __func__);
1191 return ERROR_INT(
"data not defined", __func__, 1);
1194 return ERROR_INT(
"stream not opened", __func__, 1);
1198 return ERROR_INT(
"header data read failed", __func__, 1);
1225 if (pdata) *pdata = NULL;
1226 if (psize) *psize = 0;
1228 return ERROR_INT(
"&data not defined", __func__, 1 );
1230 return ERROR_INT(
"&size not defined", __func__, 1 );
1232 return ERROR_INT(
"&pix not defined", __func__, 1 );
1235 if ((fp = open_memstream((
char **)pdata, psize)) == NULL)
1236 return ERROR_INT(
"stream not opened", __func__, 1);
1240 *psize = *psize - 1;
1242 L_INFO(
"work-around: writing to a temp file\n", __func__);
1245 return ERROR_INT(
"tmpfile stream not opened", __func__, 1);
1247 if ((fp = tmpfile()) == NULL)
1248 return ERROR_INT(
"tmpfile stream not opened", __func__, 1);
1281 if (pdata) *pdata = NULL;
1282 if (psize) *psize = 0;
1284 return ERROR_INT(
"&data not defined", __func__, 1 );
1286 return ERROR_INT(
"&size not defined", __func__, 1 );
1288 return ERROR_INT(
"&pix not defined", __func__, 1 );
1291 if ((fp = open_memstream((
char **)pdata, psize)) == NULL)
1292 return ERROR_INT(
"stream not opened", __func__, 1);
1296 *psize = *psize - 1;
1298 L_INFO(
"work-around: writing to a temp file\n", __func__);
1301 return ERROR_INT(
"tmpfile stream not opened", __func__, 1);
1303 if ((fp = tmpfile()) == NULL)
1304 return ERROR_INT(
"tmpfile stream not opened", __func__, 1);
1333 return ERROR_INT(
"&val not defined", __func__, 1);
1336 return ERROR_INT(
"stream not open", __func__, 1);
1338 if (EOF == fscanf(fp,
" "))
1340 if (1 != fscanf(fp,
"%d", pval))
1367 l_int32 i, c, foundws;
1370 return ERROR_INT(
"&val not defined", __func__, 1);
1373 return ERROR_INT(
"stream not open", __func__, 1);
1376 if (fscanf(fp,
" ") == EOF)
1377 return ERROR_INT(
"end of file reached", __func__, 1);
1382 for (i = 0; i < 8; i++)
1384 for (i = 0; i < 8; i++) {
1385 if ((c = fgetc(fp)) == EOF)
1386 return ERROR_INT(
"end of file reached", __func__, 1);
1387 if (c ==
' ' || c ==
'\t' || c ==
'\n' || c ==
'\r') {
1393 return ERROR_INT(
"char read is not a digit", __func__, 1);
1397 return ERROR_INT(
"no whitespace found", __func__, 1);
1398 if (sscanf(buf,
"%d", pval) != 1)
1399 return ERROR_INT(
"invalid read", __func__, 1);
1426 return ERROR_INT(
"buff not defined", __func__, 1);
1429 return ERROR_INT(
"size is too big", __func__, 1);
1431 return ERROR_INT(
"size is too small", __func__, 1);
1433 return ERROR_INT(
"stream not open", __func__, 1);
1436 if (fscanf(fp,
" ") == EOF)
1441 return ERROR_INT(
"end of file reached", __func__, 1);
1443 snprintf(fmtString, 7,
"%%%ds", size - 1);
1444 if (fscanf(fp, fmtString, buff) == EOF)
1469 return ERROR_INT(
"stream not open", __func__, 1);
1470 while ((i = fscanf(fp,
"#%c", &c))) {
1471 if (i == EOF)
return 1;
1473 if (fscanf(fp,
"%c", &c) == EOF)
#define GET_DATA_QBIT(pdata, n)
#define GET_DATA_TWO_BYTES(pdata, n)
#define SET_DATA_DIBIT(pdata, n, val)
#define SET_DATA_TWO_BYTES(pdata, n, val)
#define GET_DATA_BYTE(pdata, n)
#define GET_DATA_DIBIT(pdata, n)
#define SET_DATA_BYTE(pdata, n, val)
#define GET_DATA_BIT(pdata, n)
#define SET_DATA_QBIT(pdata, n, val)
l_uint32 * pixGetData(PIX *pix)
pixGetData()
void pixDestroy(PIX **ppix)
pixDestroy()
l_ok pixGetDimensions(const PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
PIX * pixCreate(l_int32 width, l_int32 height, l_int32 depth)
pixCreate()
PIX * pixClone(PIX *pixs)
pixClone()
l_ok pixSetPixel(PIX *pix, l_int32 x, l_int32 y, l_uint32 val)
pixSetPixel()
l_ok pixGetPixel(PIX *pix, l_int32 x, l_int32 y, l_uint32 *pval)
pixGetPixel()
l_ok composeRGBAPixel(l_int32 rval, l_int32 gval, l_int32 bval, l_int32 aval, l_uint32 *ppixel)
composeRGBAPixel()
l_ok composeRGBPixel(l_int32 rval, l_int32 gval, l_int32 bval, l_uint32 *ppixel)
composeRGBPixel()
@ REMOVE_CMAP_BASED_ON_SRC
PIX * pixRemoveColormap(PIX *pixs, l_int32 type)
pixRemoveColormap()
static l_int32 pnmReadNextNumber(FILE *fp, l_int32 *pval)
pnmReadNextNumber()
PIX * pixReadMemPnm(const l_uint8 *data, size_t size)
pixReadMemPnm()
static l_int32 pnmReadNextString(FILE *fp, char *buff, l_int32 size)
pnmReadNextString()
PIX * pixReadStreamPnm(FILE *fp)
pixReadStreamPnm()
l_ok pixWriteMemPam(l_uint8 **pdata, size_t *psize, PIX *pix)
pixWriteMemPam()
l_ok pixWriteStreamPnm(FILE *fp, PIX *pix)
pixWriteStreamPnm()
l_ok readHeaderPnm(const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pd, l_int32 *ptype, l_int32 *pbps, l_int32 *pspp)
readHeaderPnm()
l_ok pixWriteStreamPam(FILE *fp, PIX *pix)
pixWriteStreamPam()
static l_int32 pnmSkipCommentLines(FILE *fp)
pnmSkipCommentLines()
l_ok readHeaderMemPnm(const l_uint8 *data, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pd, l_int32 *ptype, l_int32 *pbps, l_int32 *pspp)
readHeaderMemPnm()
static l_int32 pnmReadNextAsciiValue(FILE *fp, l_int32 *pval)
pnmReadNextAsciiValue()
l_ok pixWriteStreamAsciiPnm(FILE *fp, PIX *pix)
pixWriteStreamAsciiPnm()
l_ok pixWriteMemPnm(l_uint8 **pdata, size_t *psize, PIX *pix)
pixWriteMemPnm()
l_ok freadHeaderPnm(FILE *fp, l_int32 *pw, l_int32 *ph, l_int32 *pd, l_int32 *ptype, l_int32 *pbps, l_int32 *pspp)
freadHeaderPnm()
void lept_stderr(const char *fmt,...)
lept_stderr()
l_uint8 * l_binaryReadStream(FILE *fp, size_t *pnbytes)
l_binaryReadStream()
FILE * fopenReadFromMemory(const l_uint8 *data, size_t size)
fopenReadFromMemory()
FILE * fopenWriteWinTempfile(void)
fopenWriteWinTempfile()
FILE * fopenReadStream(const char *filename)
fopenReadStream()