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;
160 PROCNAME(
"pixReadStreamPnm");
163 return (
PIX *)ERROR_PTR(
"fp not defined", procName, NULL);
166 return (
PIX *)ERROR_PTR(
"header read failed", procName, NULL);
167 if (bps < 1 || bps > 16)
168 return (
PIX *)ERROR_PTR(
"invalid bps", procName, NULL);
169 if (spp < 1 || spp > 4)
170 return (
PIX *)ERROR_PTR(
"invalid spp", procName, NULL);
172 return (
PIX *)ERROR_PTR(
"pix not made", procName, NULL);
173 pixSetInputFormat(pix, IFF_PNM);
175 wpl = pixGetWpl(pix);
179 if (type == 6 && bps == 16)
186 for (i = 0; i < h; i++) {
187 for (j = 0; j < w; j++) {
190 return (
PIX *)ERROR_PTR(
"read abend", procName, NULL);
199 for (i = 0; i < h; i++) {
200 for (j = 0; j < w; j++) {
203 return (
PIX *)ERROR_PTR(
"read abend", procName, NULL);
207 return (
PIX *)ERROR_PTR(
"read abend", procName, NULL);
211 return (
PIX *)ERROR_PTR(
"read abend", procName, NULL);
221 bpl = (d * w + 7) / 8;
222 for (i = 0; i < h; i++) {
223 line = data + i * wpl;
224 for (j = 0; j < bpl; j++) {
225 if (fread(&val8, 1, 1, fp) != 1) {
227 return (
PIX *)ERROR_PTR(
"read error in 4", procName, NULL);
236 for (i = 0; i < h; i++) {
237 line = data + i * wpl;
239 for (j = 0; j < w; j++) {
240 if (fread(&val8, 1, 1, fp) != 1) {
242 return (
PIX *)ERROR_PTR(
"error in 5", procName, NULL);
252 for (j = 0; j < w; j++) {
253 if (fread(&val16, 2, 1, fp) != 1) {
255 return (
PIX *)ERROR_PTR(
"16 bpp error", procName, NULL);
265 for (i = 0; i < h; i++) {
266 line = data + i * wpl;
267 for (j = 0; j < wpl; j++) {
268 if (fread(&rval8, 1, 1, fp) != 1) {
270 return (
PIX *)ERROR_PTR(
"read error type 6",
273 if (fread(&gval8, 1, 1, fp) != 1) {
275 return (
PIX *)ERROR_PTR(
"read error type 6",
278 if (fread(&bval8, 1, 1, fp) != 1) {
280 return (
PIX *)ERROR_PTR(
"read error type 6",
292 mask8 = (1 << bps) - 1;
295 for (i = 0; i < h; i++) {
296 for (j = 0; j < w; j++) {
297 if (fread(&val8, 1, 1, fp) != 1) {
299 return (
PIX *)ERROR_PTR(
"read error type 7",
303 if (bps == 1) val8 ^= 1;
310 for (i = 0; i < h; i++) {
311 for (j = 0; j < w; j++) {
312 if (fread(&val8, 1, 1, fp) != 1) {
314 return (
PIX *)ERROR_PTR(
"read error type 7",
317 if (fread(&aval8, 1, 1, fp) != 1) {
319 return (
PIX *)ERROR_PTR(
"read error type 7",
323 aval8 = aval8 & mask8;
332 for (i = 0; i < h; i++) {
333 line = data + i * wpl;
334 for (j = 0; j < wpl; j++) {
335 if (fread(&rval8, 1, 1, fp) != 1) {
337 return (
PIX *)ERROR_PTR(
"read error type 7",
340 if (fread(&gval8, 1, 1, fp) != 1) {
342 return (
PIX *)ERROR_PTR(
"read error type 7",
345 if (fread(&bval8, 1, 1, fp) != 1) {
347 return (
PIX *)ERROR_PTR(
"read error type 7",
350 rval8 = rval8 & mask8;
351 gval8 = gval8 & mask8;
352 bval8 = bval8 & mask8;
360 for (i = 0; i < h; i++) {
361 line = data + i * wpl;
362 for (j = 0; j < wpl; j++) {
363 if (fread(&rval8, 1, 1, fp) != 1) {
365 return (
PIX *)ERROR_PTR(
"read error type 7",
368 if (fread(&gval8, 1, 1, fp) != 1) {
370 return (
PIX *)ERROR_PTR(
"read error type 7",
373 if (fread(&bval8, 1, 1, fp) != 1) {
375 return (
PIX *)ERROR_PTR(
"read error type 7",
378 if (fread(&aval8, 1, 1, fp) != 1) {
380 return (
PIX *)ERROR_PTR(
"read error type 7",
383 rval8 = rval8 & mask8;
384 gval8 = gval8 & mask8;
385 bval8 = bval8 & mask8;
386 aval8 = aval8 & mask8;
402 for (i = 0; i < h; i++) {
403 for (j = 0; j < w; j++) {
404 if (fread(&val16, 2, 1, fp) != 1) {
406 return (
PIX *)ERROR_PTR(
"read error type 7",
416 for (i = 0; i < h; i++) {
417 for (j = 0; j < w; j++) {
418 if (fread(&val16, 2, 1, fp) != 1) {
420 return (
PIX *)ERROR_PTR(
"read error type 7",
423 if (fread(&aval16, 2, 1, fp) != 1) {
425 return (
PIX *)ERROR_PTR(
"read error type 7",
429 aval8 = aval16 & 0xff;
438 for (i = 0; i < h; i++) {
439 line = data + i * wpl;
440 for (j = 0; j < wpl; j++) {
441 if (fread(&rval16, 2, 1, fp) != 1) {
443 return (
PIX *)ERROR_PTR(
"read error type 7",
446 if (fread(&gval16, 2, 1, fp) != 1) {
448 return (
PIX *)ERROR_PTR(
"read error type 7",
451 if (fread(&bval16, 2, 1, fp) != 1) {
453 return (
PIX *)ERROR_PTR(
"read error type 7",
456 rval8 = rval16 & 0xff;
457 gval8 = gval16 & 0xff;
458 bval8 = bval16 & 0xff;
466 for (i = 0; i < h; i++) {
467 line = data + i * wpl;
468 for (j = 0; j < wpl; j++) {
469 if (fread(&rval16, 2, 1, fp) != 1) {
471 return (
PIX *)ERROR_PTR(
"read error type 7",
474 if (fread(&gval16, 2, 1, fp) != 1) {
476 return (
PIX *)ERROR_PTR(
"read error type 7",
479 if (fread(&bval16, 2, 1, fp) != 1) {
481 return (
PIX *)ERROR_PTR(
"read error type 7",
484 if (fread(&aval16, 2, 1, fp) != 1) {
486 return (
PIX *)ERROR_PTR(
"read error type 7",
489 rval8 = rval16 & 0xff;
490 gval8 = gval16 & 0xff;
491 bval8 = bval16 & 0xff;
492 aval8 = aval16 & 0xff;
531 PROCNAME(
"readHeaderPnm");
536 if (ptype) *ptype = 0;
540 return ERROR_INT(
"filename not defined", procName, 1);
543 return ERROR_INT(
"image file not found", procName, 1);
571 char tag[16], tupltype[32];
572 l_int32 i, w, h, d, bps, spp, type;
576 PROCNAME(
"freadHeaderPnm");
581 if (ptype) *ptype = 0;
585 return ERROR_INT(
"fp not defined", procName, 1);
587 if (fscanf(fp,
"P%d\n", &type) != 1)
588 return ERROR_INT(
"invalid read for type", procName, 1);
589 if (type < 1 || type > 7)
590 return ERROR_INT(
"invalid pnm file", procName, 1);
593 return ERROR_INT(
"no data in file", procName, 1);
596 w = h = d = bps = spp = maxval = 0;
597 for (i = 0; i < 10; i++) {
599 return ERROR_INT(
"found no next tag", procName, 1);
600 if (!strcmp(tag,
"WIDTH")) {
602 return ERROR_INT(
"failed reading width", procName, 1);
605 if (!strcmp(tag,
"HEIGHT")) {
607 return ERROR_INT(
"failed reading height", procName, 1);
610 if (!strcmp(tag,
"DEPTH")) {
612 return ERROR_INT(
"failed reading depth", procName, 1);
615 if (!strcmp(tag,
"MAXVAL")) {
617 return ERROR_INT(
"failed reading maxval", procName, 1);
620 if (!strcmp(tag,
"TUPLTYPE")) {
622 return ERROR_INT(
"failed reading tuple type", procName, 1);
625 if (!strcmp(tag,
"ENDHDR")) {
626 if (
'\n' != (ch = fgetc(fp)))
627 return ERROR_INT(
"missing LF after ENDHDR", procName, 1);
631 if (w <= 0 || h <= 0 || w > MAX_PNM_WIDTH || h > MAX_PNM_HEIGHT) {
632 L_INFO(
"invalid size: w = %d, h = %d\n", procName, w, h);
637 }
else if (maxval == 3) {
639 }
else if (maxval == 15) {
641 }
else if (maxval == 255) {
643 }
else if (maxval == 0xffff) {
646 L_INFO(
"invalid maxval = %d\n", procName, maxval);
660 L_INFO(
"invalid depth = %d\n", procName, spp);
665 if (fscanf(fp,
"%d %d\n", &w, &h) != 2)
666 return ERROR_INT(
"invalid read for w,h", procName, 1);
667 if (w <= 0 || h <= 0 || w > MAX_PNM_WIDTH || h > MAX_PNM_HEIGHT) {
668 L_INFO(
"invalid size: w = %d, h = %d\n", procName, w, h);
681 if (type == 1 || type == 4) {
685 }
else if (type == 2 || type == 5) {
687 return ERROR_INT(
"invalid read for maxval (2,5)", procName, 1);
690 }
else if (maxval == 15) {
692 }
else if (maxval == 255) {
694 }
else if (maxval == 0xffff) {
698 return ERROR_INT(
"invalid maxval", procName, 1);
704 return ERROR_INT(
"invalid read for maxval (3,6)", procName, 1);
705 if (maxval != 255 && maxval != 0xffff) {
706 L_ERROR(
"unexpected maxval = %d\n", procName, maxval);
709 bps = (maxval == 255) ? 8 : 16;
717 if (ptype) *ptype = type;
718 if (pbps) *pbps = bps;
719 if (pspp) *pspp = spp;
748 l_int32 h, w, d, ds, i, j, wpls, bpl, filebpl, writeerror, maxval;
749 l_uint32 *pword, *datas, *lines;
752 PROCNAME(
"pixWriteStreamPnm");
755 return ERROR_INT(
"fp not defined", procName, 1);
757 return ERROR_INT(
"pix not defined", procName, 1);
760 if (d != 1 && d != 2 && d != 4 && d != 8 && d != 16 && d != 24 && d != 32)
761 return ERROR_INT(
"d not in {1,2,4,8,16,24,32}", procName, 1);
762 if (d == 32 && pixGetSpp(pix) == 4)
766 if (pixGetColormap(pix) != NULL)
770 ds = pixGetDepth(pixs);
772 wpls = pixGetWpl(pixs);
777 fprintf(fp,
"P4\n# Raw PBM file written by leptonica "
778 "(www.leptonica.com)\n%d %d\n", w, h);
781 for (i = 0; i < h; i++) {
782 lines = datas + i * wpls;
783 for (j = 0; j < bpl; j++) {
785 fwrite(&val8, 1, 1, fp);
788 }
else if (ds == 2 || ds == 4 || ds == 8 || ds == 16) {
789 maxval = (1 << ds) - 1;
790 fprintf(fp,
"P5\n# Raw PGM file written by leptonica "
791 "(www.leptonica.com)\n%d %d\n%d\n", w, h, maxval);
794 for (i = 0; i < h; i++) {
795 lines = datas + i * wpls;
796 for (j = 0; j < w; j++) {
803 fwrite(&val8, 1, 1, fp);
807 for (i = 0; i < h; i++) {
808 lines = datas + i * wpls;
809 for (j = 0; j < w; j++) {
811 fwrite(&val16, 2, 1, fp);
816 fprintf(fp,
"P6\n# Raw PPM file written by leptonica "
817 "(www.leptonica.com)\n%d %d\n255\n", w, h);
821 for (i = 0; i < h; i++) {
822 lines = datas + i * wpls;
823 if (fwrite(lines, 1, filebpl, fp) != filebpl)
827 for (i = 0; i < h; i++) {
828 lines = datas + i * wpls;
829 for (j = 0; j < wpls; j++) {
834 if (fwrite(pel, 1, 3, fp) != 3)
843 return ERROR_INT(
"image write fail", procName, 1);
866 l_int32 h, w, d, ds, i, j, k, maxval, count;
870 PROCNAME(
"pixWriteStreamAsciiPnm");
873 return ERROR_INT(
"fp not defined", procName, 1);
875 return ERROR_INT(
"pix not defined", procName, 1);
878 if (d != 1 && d != 2 && d != 4 && d != 8 && d != 16 && d != 32)
879 return ERROR_INT(
"d not in {1,2,4,8,16,32}", procName, 1);
882 if (pixGetColormap(pix) != NULL)
886 ds = pixGetDepth(pixs);
889 fprintf(fp,
"P1\n# Ascii PBM file written by leptonica "
890 "(www.leptonica.com)\n%d %d\n", w, h);
893 for (i = 0; i < h; i++) {
894 for (j = 0; j < w; j++) {
908 }
else if (ds == 2 || ds == 4 || ds == 8 || ds == 16) {
909 maxval = (1 << ds) - 1;
910 fprintf(fp,
"P2\n# Ascii PGM file written by leptonica "
911 "(www.leptonica.com)\n%d %d\n%d\n", w, h, maxval);
914 for (i = 0; i < h; i++) {
915 for (j = 0; j < w; j++) {
918 snprintf(buffer,
sizeof(buffer),
"%1d ", val);
919 fwrite(buffer, 1, 2, fp);
921 }
else if (ds == 4) {
922 snprintf(buffer,
sizeof(buffer),
"%2d ", val);
923 fwrite(buffer, 1, 3, fp);
925 }
else if (ds == 8) {
926 snprintf(buffer,
sizeof(buffer),
"%3d ", val);
927 fwrite(buffer, 1, 4, fp);
930 snprintf(buffer,
sizeof(buffer),
"%5d ", val);
931 fwrite(buffer, 1, 6, fp);
941 fprintf(fp,
"P3\n# Ascii PPM file written by leptonica "
942 "(www.leptonica.com)\n%d %d\n255\n", w, h);
944 for (i = 0; i < h; i++) {
945 for (j = 0; j < w; j++) {
950 for (k = 0; k < 3; k++) {
951 snprintf(buffer,
sizeof(buffer),
"%3d ", cval[k]);
952 fwrite(buffer, 1, 4, fp);
989 l_int32 h, w, d, ds, i, j;
990 l_int32 wpls, spps, filebpl, writeerror, maxval;
991 l_uint32 *pword, *datas, *lines;
994 PROCNAME(
"pixWriteStreamPam");
997 return ERROR_INT(
"fp not defined", procName, 1);
999 return ERROR_INT(
"pix not defined", procName, 1);
1002 if (d != 1 && d != 2 && d != 4 && d != 8 && d != 16 && d != 24 && d != 32)
1003 return ERROR_INT(
"d not in {1,2,4,8,16,24,32}", procName, 1);
1006 if (pixGetColormap(pix) != NULL)
1010 ds = pixGetDepth(pixs);
1012 wpls = pixGetWpl(pixs);
1013 spps = pixGetSpp(pixs);
1015 maxval = (1 << ds) - 1;
1020 fprintf(fp,
"P7\n# Arbitrary PAM file written by leptonica "
1021 "(www.leptonica.com)\n");
1022 fprintf(fp,
"WIDTH %d\n", w);
1023 fprintf(fp,
"HEIGHT %d\n", h);
1024 fprintf(fp,
"DEPTH %d\n", spps);
1025 fprintf(fp,
"MAXVAL %d\n", maxval);
1026 if (spps == 1 && ds == 1)
1027 fprintf(fp,
"TUPLTYPE BLACKANDWHITE\n");
1029 fprintf(fp,
"TUPLTYPE GRAYSCALE\n");
1031 fprintf(fp,
"TUPLTYPE RGB\n");
1033 fprintf(fp,
"TUPLTYPE RGB_ALPHA\n");
1034 fprintf(fp,
"ENDHDR\n");
1038 for (i = 0; i < h; i++) {
1039 lines = datas + i * wpls;
1040 for (j = 0; j < w; j++) {
1043 if (fwrite(&val8, 1, 1, fp) != 1)
1050 for (i = 0; i < h; i++) {
1051 lines = datas + i * wpls;
1052 for (j = 0; j < w; j++) {
1054 if (fwrite(&val8, 1, 1, fp) != 1)
1061 for (i = 0; i < h; i++) {
1062 lines = datas + i * wpls;
1063 for (j = 0; j < w; j++) {
1065 if (fwrite(&val8, 1, 1, fp) != 1)
1072 for (i = 0; i < h; i++) {
1073 lines = datas + i * wpls;
1074 for (j = 0; j < w; j++) {
1076 if (fwrite(&val8, 1, 1, fp) != 1)
1083 for (i = 0; i < h; i++) {
1084 lines = datas + i * wpls;
1085 for (j = 0; j < w; j++) {
1087 if (fwrite(&val16, 2, 1, fp) != 1)
1095 for (i = 0; i < h; i++) {
1096 lines = datas + i * wpls;
1097 if (fwrite(lines, 1, filebpl, fp) != filebpl)
1105 for (i = 0; i < h; i++) {
1106 lines = datas + i * wpls;
1107 for (j = 0; j < wpls; j++) {
1112 if (fwrite(pel, 1, 3, fp) != 3)
1118 for (i = 0; i < h; i++) {
1119 lines = datas + i * wpls;
1120 for (j = 0; j < wpls; j++) {
1126 if (fwrite(pel, 1, 4, fp) != 4)
1137 return ERROR_INT(
"image write fail", procName, 1);
1165 PROCNAME(
"pixReadMemPnm");
1168 return (
PIX *)ERROR_PTR(
"data not defined", procName, NULL);
1170 return (
PIX *)ERROR_PTR(
"stream not opened", procName, NULL);
1173 if (!pix) L_ERROR(
"pix not read\n", procName);
1204 PROCNAME(
"readHeaderMemPnm");
1207 return ERROR_INT(
"data not defined", procName, 1);
1210 return ERROR_INT(
"stream not opened", procName, 1);
1214 return ERROR_INT(
"header data read failed", procName, 1);
1241 PROCNAME(
"pixWriteMemPnm");
1243 if (pdata) *pdata = NULL;
1244 if (psize) *psize = 0;
1246 return ERROR_INT(
"&data not defined", procName, 1 );
1248 return ERROR_INT(
"&size not defined", procName, 1 );
1250 return ERROR_INT(
"&pix not defined", procName, 1 );
1253 if ((fp = open_memstream((
char **)pdata, psize)) == NULL)
1254 return ERROR_INT(
"stream not opened", procName, 1);
1258 *psize = *psize - 1;
1260 L_INFO(
"work-around: writing to a temp file\n", procName);
1263 return ERROR_INT(
"tmpfile stream not opened", procName, 1);
1265 if ((fp = tmpfile()) == NULL)
1266 return ERROR_INT(
"tmpfile stream not opened", procName, 1);
1299 PROCNAME(
"pixWriteMemPam");
1301 if (pdata) *pdata = NULL;
1302 if (psize) *psize = 0;
1304 return ERROR_INT(
"&data not defined", procName, 1 );
1306 return ERROR_INT(
"&size not defined", procName, 1 );
1308 return ERROR_INT(
"&pix not defined", procName, 1 );
1311 if ((fp = open_memstream((
char **)pdata, psize)) == NULL)
1312 return ERROR_INT(
"stream not opened", procName, 1);
1316 *psize = *psize - 1;
1318 L_INFO(
"work-around: writing to a temp file\n", procName);
1321 return ERROR_INT(
"tmpfile stream not opened", procName, 1);
1323 if ((fp = tmpfile()) == NULL)
1324 return ERROR_INT(
"tmpfile stream not opened", procName, 1);
1352 PROCNAME(
"pnmReadNextAsciiValue");
1355 return ERROR_INT(
"&val not defined", procName, 1);
1358 return ERROR_INT(
"stream not open", procName, 1);
1360 if (EOF == fscanf(fp,
" "))
1362 if (1 != fscanf(fp,
"%d", pval))
1389 l_int32 i, c, foundws;
1391 PROCNAME(
"pnmReadNextNumber");
1394 return ERROR_INT(
"&val not defined", procName, 1);
1397 return ERROR_INT(
"stream not open", procName, 1);
1400 if (fscanf(fp,
" ") == EOF)
1401 return ERROR_INT(
"end of file reached", procName, 1);
1406 for (i = 0; i < 8; i++)
1408 for (i = 0; i < 8; i++) {
1409 if ((c = fgetc(fp)) == EOF)
1410 return ERROR_INT(
"end of file reached", procName, 1);
1411 if (c ==
' ' || c ==
'\t' || c ==
'\n' || c ==
'\r') {
1417 return ERROR_INT(
"char read is not a digit", procName, 1);
1421 return ERROR_INT(
"no whitespace found", procName, 1);
1422 if (sscanf(buf,
"%d", pval) != 1)
1423 return ERROR_INT(
"invalid read", procName, 1);
1450 PROCNAME(
"pnmReadNextString");
1453 return ERROR_INT(
"buff not defined", procName, 1);
1456 return ERROR_INT(
"size is too big", procName, 1);
1458 return ERROR_INT(
"size is too small", procName, 1);
1460 return ERROR_INT(
"stream not open", procName, 1);
1463 if (fscanf(fp,
" ") == EOF)
1468 return ERROR_INT(
"end of file reached", procName, 1);
1470 snprintf(fmtString, 6,
"%%%ds", size-1);
1471 if (fscanf(fp, fmtString, buff) == EOF)
1495 PROCNAME(
"pnmSkipCommentLines");
1498 return ERROR_INT(
"stream not open", procName, 1);
1499 while ((i = fscanf(fp,
"#%c", &c))) {
1500 if (i == EOF)
return 1;
1502 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()