75 #include "config_auto.h" 79 #include "allheaders.h" 82 static const char *FILE_BMP =
"/tmp/lept/format/file.bmp";
83 static const char *FILE_PNG =
"/tmp/lept/format/file.png";
84 static const char *FILE_PNM =
"/tmp/lept/format/file.pnm";
85 static const char *FILE_G3 =
"/tmp/lept/format/file_g3.tif";
86 static const char *FILE_G4 =
"/tmp/lept/format/file_g4.tif";
87 static const char *FILE_RLE =
"/tmp/lept/format/file_rle.tif";
88 static const char *FILE_PB =
"/tmp/lept/format/file_packbits.tif";
89 static const char *FILE_LZW =
"/tmp/lept/format/file_lzw.tif";
90 static const char *FILE_ZIP =
"/tmp/lept/format/file_zip.tif";
91 static const char *FILE_TIFF_JPEG =
"/tmp/lept/format/file_jpeg.tif";
92 static const char *FILE_TIFF =
"/tmp/lept/format/file.tif";
93 static const char *FILE_JPG =
"/tmp/lept/format/file.jpg";
94 static const char *FILE_GIF =
"/tmp/lept/format/file.gif";
95 static const char *FILE_WEBP =
"/tmp/lept/format/file.webp";
96 static const char *FILE_JP2K =
"/tmp/lept/format/file.jp2";
98 static const unsigned char JP2K_CODESTREAM[4] = { 0xff, 0x4f, 0xff, 0x51 };
99 static const unsigned char JP2K_IMAGE_DATA[12] = { 0x00, 0x00, 0x00, 0x0C,
100 0x6A, 0x50, 0x20, 0x20,
101 0x0D, 0x0A, 0x87, 0x0A };
130 PROCNAME(
"pixaReadFiles");
133 return (
PIXA *)ERROR_PTR(
"dirname not defined", procName, NULL);
136 return (
PIXA *)ERROR_PTR(
"sa not made", procName, NULL);
158 PROCNAME(
"pixaReadFilesSA");
161 return (
PIXA *)ERROR_PTR(
"sa not defined", procName, NULL);
165 for (i = 0; i < n; i++) {
167 if ((pix =
pixRead(str)) == NULL) {
168 L_WARNING(
"pix not read from file %s\n", procName, str);
198 return (
PIX *)ERROR_PTR(
"filename not defined", procName, NULL);
201 L_ERROR(
"image file not found: %s\n", procName, filename);
207 return (
PIX *)ERROR_PTR(
"pix not read", procName, NULL);
232 PROCNAME(
"pixReadWithHint");
235 return (
PIX *)ERROR_PTR(
"filename not defined", procName, NULL);
238 return (
PIX *)ERROR_PTR(
"image file not found", procName, NULL);
243 return (
PIX *)ERROR_PTR(
"image not returned", procName, NULL);
284 PROCNAME(
"pixReadIndexed");
287 return (
PIX *)ERROR_PTR(
"sa not defined", procName, NULL);
289 if (index < 0 || index >= n)
290 return (
PIX *)ERROR_PTR(
"index out of bounds", procName, NULL);
293 if (fname[0] ==
'\0')
296 if ((pix =
pixRead(fname)) == NULL) {
297 L_ERROR(
"pix not read from file %s\n", procName, fname);
321 l_int32 format, ret, valid;
326 PROCNAME(
"pixReadStream");
329 return (
PIX *)ERROR_PTR(
"stream not defined", procName, NULL);
337 return (
PIX *)ERROR_PTR(
"bmp: no pix returned", procName, NULL);
342 return (
PIX *)ERROR_PTR(
"jpeg: no pix returned", procName, NULL);
343 ret = fgetJpegComment(fp, &comment);
351 return (
PIX *)ERROR_PTR(
"png: no pix returned", procName, NULL);
355 case IFF_TIFF_PACKBITS:
363 return (
PIX *)ERROR_PTR(
"tiff: no pix returned", procName, NULL);
368 return (
PIX *)ERROR_PTR(
"pnm: no pix returned", procName, NULL);
372 if ((pix = pixReadStreamGif(fp)) == NULL)
373 return (
PIX *)ERROR_PTR(
"gif: no pix returned", procName, NULL);
377 if ((pix = pixReadStreamJp2k(fp, 1, NULL, 0, 0)) == NULL)
378 return (
PIX *)ERROR_PTR(
"jp2: no pix returned", procName, NULL);
382 if ((pix = pixReadStreamWebP(fp)) == NULL)
383 return (
PIX *)ERROR_PTR(
"webp: no pix returned", procName, NULL);
387 L_ERROR(
"PostScript reading is not supported\n", procName);
391 L_ERROR(
"Pdf reading is not supported\n", procName);
396 return (
PIX *)ERROR_PTR(
"spix: no pix returned", procName, NULL);
400 return (
PIX *)ERROR_PTR(
"Unknown format: no pix returned",
406 pixSetInputFormat(pix, format);
407 if ((cmap = pixGetColormap(pix))) {
411 return (
PIX *)ERROR_PTR(
"invalid colormap", procName, NULL);
450 l_int32 format, ret, w, h, d, bps, spp, iscmap;
455 PROCNAME(
"pixReadHeader");
461 if (piscmap) *piscmap = 0;
462 if (pformat) *pformat = 0;
465 return ERROR_INT(
"filename not defined", procName, 1);
468 return ERROR_INT(
"image file not found", procName, 1);
475 if ((pix =
pixRead(filename)) == NULL)
476 return ERROR_INT(
"bmp: pix not read", procName, 1);
478 if (pixGetColormap(pix))
481 bps = (d == 32) ? 8 : d;
482 spp = (d == 32) ? 3 : 1;
489 return ERROR_INT(
"jpeg: no header info returned", procName, 1);
495 return ERROR_INT(
"png: no header info returned", procName, 1);
499 case IFF_TIFF_PACKBITS:
507 ret =
readHeaderTiff(filename, 0, &w, &h, &bps, &spp, NULL, &iscmap,
510 return ERROR_INT(
"tiff: no header info returned", procName, 1);
514 ret =
readHeaderPnm(filename, &w, &h, &d, &type, &bps, &spp);
516 return ERROR_INT(
"pnm: no header info returned", procName, 1);
520 if ((pix =
pixRead(filename)) == NULL)
521 return ERROR_INT(
"gif: pix not read", procName, 1);
534 if (readHeaderWebP(filename, &w, &h, &spp))
535 return ERROR_INT(
"webp: no header info returned", procName, 1);
540 if (pformat) *pformat = format;
541 return ERROR_INT(
"PostScript reading is not supported\n", procName, 1);
544 if (pformat) *pformat = format;
545 return ERROR_INT(
"Pdf reading is not supported\n", procName, 1);
550 return ERROR_INT(
"spix: no header info returned", procName, 1);
554 L_ERROR(
"unknown format in file %s\n", procName, filename);
561 if (pbps) *pbps = bps;
562 if (pspp) *pspp = spp;
563 if (piscmap) *piscmap = iscmap;
564 if (pformat) *pformat = format;
586 PROCNAME(
"findFileFormat");
589 return ERROR_INT(
"&format not defined", procName, 1);
590 *pformat = IFF_UNKNOWN;
592 return ERROR_INT(
"filename not defined", procName, 1);
595 return ERROR_INT(
"image file not found", procName, 1);
618 l_uint8 firstbytes[12];
621 PROCNAME(
"findFileFormatStream");
624 return ERROR_INT(
"&format not defined", procName, 1);
625 *pformat = IFF_UNKNOWN;
627 return ERROR_INT(
"stream not defined", procName, 1);
631 return ERROR_INT(
"truncated file", procName, 1);
633 if (fread(&firstbytes, 1, 12, fp) != 12)
634 return ERROR_INT(
"failed to read first 12 bytes of file", procName, 1);
638 if (format == IFF_TIFF) {
643 if (format == IFF_UNKNOWN)
671 PROCNAME(
"findFileFormatBuffer");
674 return ERROR_INT(
"&format not defined", procName, 1);
675 *pformat = IFF_UNKNOWN;
677 return ERROR_INT(
"byte buffer not defined", procName, 0);
680 ((
char *)(&twobytepw))[0] = buf[0];
681 ((
char *)(&twobytepw))[1] = buf[1];
683 if (convertOnBigEnd16(twobytepw) ==
BMP_ID) {
694 if ((buf[0] ==
'P' && buf[1] ==
'4') ||
695 (buf[0] ==
'P' && buf[1] ==
'1')) {
700 if ((buf[0] ==
'P' && buf[1] ==
'5') ||
701 (buf[0] ==
'P' && buf[1] ==
'2')) {
706 if ((buf[0] ==
'P' && buf[1] ==
'6') ||
707 (buf[0] ==
'P' && buf[1] ==
'3')) {
712 if (buf[0] ==
'P' && buf[1] ==
'7') {
728 if (buf[0] == 0xff && buf[1] == 0xd8) {
729 *pformat = IFF_JFIF_JPEG;
735 if (buf[0] == 137 && buf[1] == 80 && buf[2] == 78 && buf[3] == 71 &&
736 buf[4] == 13 && buf[5] == 10 && buf[6] == 26 && buf[7] == 10) {
742 if (buf[0] ==
'G' && buf[1] ==
'I' && buf[2] ==
'F' && buf[3] ==
'8' &&
743 (buf[4] ==
'7' || buf[4] ==
'9') && buf[5] ==
'a') {
749 if (memcmp(buf, JP2K_CODESTREAM, 4) == 0 ||
750 memcmp(buf, JP2K_IMAGE_DATA, 12) == 0) {
756 if (buf[0] ==
'R' && buf[1] ==
'I' && buf[2] ==
'F' && buf[3] ==
'F' &&
757 buf[8] ==
'W' && buf[9] ==
'E' && buf[10] ==
'B' && buf[11] ==
'P') {
763 if (buf[0] ==
'%' && buf[1] ==
'!' && buf[2] ==
'P' && buf[3] ==
'S' &&
764 buf[4] ==
'-' && buf[5] ==
'A' && buf[6] ==
'd' && buf[7] ==
'o' &&
765 buf[8] ==
'b' && buf[9] ==
'e') {
771 if (buf[0] ==
'%' && buf[1] ==
'P' && buf[2] ==
'D' && buf[3] ==
'F' &&
772 buf[4] ==
'-' && buf[5] ==
'1') {
778 if (buf[0] ==
's' && buf[1] ==
'p' && buf[2] ==
'i' && buf[3] ==
'x') {
799 PROCNAME(
"fileFormatIsTiff");
802 return ERROR_INT(
"stream not defined", procName, 0);
805 if (format == IFF_TIFF || format == IFF_TIFF_PACKBITS ||
806 format == IFF_TIFF_RLE || format == IFF_TIFF_G3 ||
807 format == IFF_TIFF_G4 || format == IFF_TIFF_LZW ||
808 format == IFF_TIFF_ZIP || format == IFF_TIFF_JPEG)
842 l_int32 format, valid;
846 PROCNAME(
"pixReadMem");
849 return (
PIX *)ERROR_PTR(
"data not defined", procName, NULL);
851 return (
PIX *)ERROR_PTR(
"size < 12", procName, NULL);
859 return (
PIX *)ERROR_PTR(
"bmp: no pix returned", procName, NULL);
864 return (
PIX *)ERROR_PTR(
"jpeg: no pix returned", procName, NULL);
869 return (
PIX *)ERROR_PTR(
"png: no pix returned", procName, NULL);
873 case IFF_TIFF_PACKBITS:
881 return (
PIX *)ERROR_PTR(
"tiff: no pix returned", procName, NULL);
886 return (
PIX *)ERROR_PTR(
"pnm: no pix returned", procName, NULL);
890 if ((pix = pixReadMemGif(data, size)) == NULL)
891 return (
PIX *)ERROR_PTR(
"gif: no pix returned", procName, NULL);
895 if ((pix = pixReadMemJp2k(data, size, 1, NULL, 0, 0)) == NULL)
896 return (
PIX *)ERROR_PTR(
"jp2k: no pix returned", procName, NULL);
900 if ((pix = pixReadMemWebP(data, size)) == NULL)
901 return (
PIX *)ERROR_PTR(
"webp: no pix returned", procName, NULL);
905 L_ERROR(
"PostScript reading is not supported\n", procName);
909 L_ERROR(
"Pdf reading is not supported\n", procName);
914 return (
PIX *)ERROR_PTR(
"spix: no pix returned", procName, NULL);
918 return (
PIX *)ERROR_PTR(
"Unknown format: no pix returned",
927 if (format == IFF_TIFF && pixGetDepth(pix) == 1)
928 format = IFF_TIFF_G4;
929 pixSetInputFormat(pix, format);
930 if ((cmap = pixGetColormap(pix))) {
934 return (
PIX *)ERROR_PTR(
"invalid colormap", procName, NULL);
977 l_int32 format, ret, w, h, d, bps, spp, iscmap;
981 PROCNAME(
"pixReadHeaderMem");
987 if (piscmap) *piscmap = 0;
988 if (pformat) *pformat = 0;
991 return ERROR_INT(
"data not defined", procName, 1);
993 return ERROR_INT(
"size < 8", procName, 1);
1001 return ERROR_INT(
"bmp: pix not read", procName, 1);
1004 bps = (d == 32) ? 8 : d;
1005 spp = (d == 32) ? 3 : 1;
1012 return ERROR_INT(
"jpeg: no header info returned", procName, 1);
1018 return ERROR_INT(
"png: no header info returned", procName, 1);
1022 case IFF_TIFF_PACKBITS:
1031 NULL, &iscmap, &format);
1033 return ERROR_INT(
"tiff: no header info returned", procName, 1);
1039 return ERROR_INT(
"pnm: no header info returned", procName, 1);
1043 if ((pix = pixReadMemGif(data, size)) == NULL)
1044 return ERROR_INT(
"gif: pix not read", procName, 1);
1058 ret = readHeaderMemWebP(data, size, &w, &h, &spp);
1062 if (pformat) *pformat = format;
1063 return ERROR_INT(
"PostScript reading is not supported\n", procName, 1);
1066 if (pformat) *pformat = format;
1067 return ERROR_INT(
"Pdf reading is not supported\n", procName, 1);
1073 return ERROR_INT(
"pnm: no header info returned", procName, 1);
1077 return ERROR_INT(
"unknown format; no data returned", procName, 1);
1083 if (pbps) *pbps = bps;
1084 if (pspp) *pspp = spp;
1085 if (piscmap) *piscmap = iscmap;
1086 if (pformat) *pformat = format;
1094 extern const char *ImageFileFormatExtensions[];
1120 l_int32 w, h, d, wpl, count, npages, color;
1121 l_int32 format, bps, spp, iscmap, xres, yres, transparency;
1126 PROCNAME(
"writeImageFileInfo");
1129 return ERROR_INT(
"filename not defined", procName, 1);
1131 return ERROR_INT(
"stream not defined", procName, 1);
1134 if (
pixReadHeader(filename, &format, &w, &h, &bps, &spp, &iscmap)) {
1135 L_ERROR(
"failure to read header of %s\n", procName, filename);
1138 fprintf(fpout,
"===============================================\n" 1139 "Reading the header:\n");
1140 fprintf(fpout,
" input image format type: %s\n",
1141 ImageFileFormatExtensions[format]);
1142 fprintf(fpout,
" w = %d, h = %d, bps = %d, spp = %d, iscmap = %d\n",
1143 w, h, bps, spp, iscmap);
1146 if (format == IFF_JP2) {
1148 fgetJp2kResolution(fpin, &xres, &yres);
1150 fprintf(fpout,
" xres = %d, yres = %d\n", xres, yres);
1151 }
else if (format == IFF_PNG) {
1153 fgetPngResolution(fpin, &xres, &yres);
1155 fprintf(fpout,
" xres = %d, yres = %d\n", xres, yres);
1158 fgetPngColormapInfo(fpin, &cmap, &transparency);
1161 fprintf(fpout,
" colormap has transparency\n");
1163 fprintf(fpout,
" colormap does not have transparency\n");
1167 }
else if (format == IFF_JFIF_JPEG) {
1169 fgetJpegResolution(fpin, &xres, &yres);
1171 fprintf(fpout,
" xres = %d, yres = %d\n", xres, yres);
1179 fprintf(fpout,
"===============================================\n" 1180 "Reading the full image:\n");
1183 if (format == IFF_PNG && bps == 16)
1186 if ((pix =
pixRead(filename)) == NULL) {
1187 L_ERROR(
"failure to read full image of %s\n", procName, filename);
1191 format = pixGetInputFormat(pix);
1193 wpl = pixGetWpl(pix);
1194 spp = pixGetSpp(pix);
1195 fprintf(fpout,
" input image format type: %s\n",
1196 ImageFileFormatExtensions[format]);
1197 fprintf(fpout,
" w = %d, h = %d, d = %d, spp = %d, wpl = %d\n",
1199 fprintf(fpout,
" xres = %d, yres = %d\n",
1200 pixGetXRes(pix), pixGetYRes(pix));
1204 fprintf(fpout,
" text: %s\n", text);
1206 cmap = pixGetColormap(pix);
1210 fprintf(fpout,
" colormap exists and has color values:");
1212 fprintf(fpout,
" colormap exists and has only gray values:");
1216 fprintf(fpout,
" colormap does not exist\n");
1218 if (format == IFF_TIFF || format == IFF_TIFF_G4 ||
1219 format == IFF_TIFF_G3 || format == IFF_TIFF_PACKBITS) {
1220 fprintf(fpout,
" Tiff header information:\n");
1225 fprintf(fpout,
" One page in file\n");
1227 fprintf(fpout,
" %d pages in file\n", npages);
1234 fprintf(fpout,
" 1 bpp: foreground pixel fraction ON/Total = %g\n",
1235 (l_float32)count / (l_float32)(w * h));
1237 fprintf(fpout,
"===============================================\n");
1243 if (pixGetSpp(pix) == 4) {
1245 pixDisplay(pixt, 100, 100);
1249 if (format == IFF_PNG && bps == 16)
1285 l_int32 w, h, d, depth, equal, problems;
1288 PIX *pixs, *pixc, *pix1, *pix2;
1291 PROCNAME(
"ioFormatTest");
1294 return ERROR_INT(
"filename not defined", procName, 1);
1297 if ((pix1 =
pixRead(filename)) == NULL)
1298 return ERROR_INT(
"pix1 not made", procName, 1);
1300 if (w > 250 && h > 250) {
1301 box =
boxCreate(w / 2 - 125, h / 2 - 125, 250, 250);
1320 if (pixGetSpp(pixc) == 4)
1322 cmap = pixGetColormap(pixc);
1323 d = pixGetDepth(pixc);
1334 if (d == 1 || d == 8) {
1335 L_INFO(
"write/read bmp\n", procName);
1336 pixWrite(FILE_BMP, pixc, IFF_BMP);
1344 L_INFO(
" **** bad bmp image: d = %d ****\n", procName, d);
1351 if (d == 2 || d == 4 || d == 32) {
1352 L_INFO(
"write/read bmp\n", procName);
1353 pixWrite(FILE_BMP, pixc, IFF_BMP);
1357 L_INFO(
" **** bad bmp image: d = %d ****\n", procName, d);
1368 L_INFO(
"write/read png\n", procName);
1369 pixWrite(FILE_PNG, pixc, IFF_PNG);
1373 L_INFO(
" **** bad png image: d = %d ****\n", procName, d);
1392 L_INFO(
"write/read uncompressed tiff\n", procName);
1393 pixWrite(FILE_TIFF, pixc, IFF_TIFF);
1397 L_INFO(
" **** bad tiff uncompressed image: d = %d ****\n",
1404 L_INFO(
"write/read lzw compressed tiff\n", procName);
1405 pixWrite(FILE_LZW, pixc, IFF_TIFF_LZW);
1409 L_INFO(
" **** bad tiff lzw compressed image: d = %d ****\n",
1416 L_INFO(
"write/read zip compressed tiff\n", procName);
1417 pixWrite(FILE_ZIP, pixc, IFF_TIFF_ZIP);
1421 L_INFO(
" **** bad tiff zip compressed image: d = %d ****\n",
1428 if (d == 8 || d == 32) {
1430 L_INFO(
"write/read jpeg compressed tiff\n", procName);
1431 if (d == 8 && pixGetColormap(pixc)) {
1433 pixWrite(FILE_TIFF_JPEG, pixc1, IFF_TIFF_JPEG);
1434 if ((pix1 =
pixRead(FILE_TIFF_JPEG)) == NULL) {
1435 L_INFO(
" did not read FILE_TIFF_JPEG\n", procName);
1440 pixWrite(FILE_TIFF_JPEG, pixc, IFF_TIFF_JPEG);
1441 pix1 =
pixRead(FILE_TIFF_JPEG);
1446 pixCompareRGB(pix1, pixc, L_COMPARE_ABS_DIFF, 0, NULL, &diff,
1450 L_INFO(
" **** bad tiff jpeg compressed image: " 1451 "d = %d, diff = %5.2f ****\n", procName, d, diff);
1460 L_INFO(
"write/read g4 compressed tiff\n", procName);
1461 pixWrite(FILE_G4, pixc, IFF_TIFF_G4);
1465 L_INFO(
" **** bad tiff g4 image ****\n", procName);
1470 L_INFO(
"write/read g3 compressed tiff\n", procName);
1471 pixWrite(FILE_G3, pixc, IFF_TIFF_G3);
1475 L_INFO(
" **** bad tiff g3 image ****\n", procName);
1480 L_INFO(
"write/read rle compressed tiff\n", procName);
1481 pixWrite(FILE_RLE, pixc, IFF_TIFF_RLE);
1485 L_INFO(
" **** bad tiff rle image: d = %d ****\n", procName, d);
1490 L_INFO(
"write/read packbits compressed tiff\n", procName);
1491 pixWrite(FILE_PB, pixc, IFF_TIFF_PACKBITS);
1495 L_INFO(
" **** bad tiff packbits image: d = %d ****\n",
1509 L_INFO(
"write/read pnm\n", procName);
1510 pixWrite(FILE_PNM, pixc, IFF_PNM);
1518 L_INFO(
" **** bad pnm image: d = %d ****\n", procName, d);
1527 if (d != 8 || !cmap)
1531 L_INFO(
"write/read gif\n", procName);
1532 pixWrite(FILE_GIF, pix1, IFF_GIF);
1536 L_INFO(
" **** bad gif image: d = %d ****\n", procName, d);
1550 depth = pixGetDepth(pix1);
1551 L_INFO(
"write/read jpeg\n", procName);
1552 pixWrite(FILE_JPG, pix1, IFF_JFIF_JPEG);
1558 pixCompareRGB(pix1, pix2, L_COMPARE_ABS_DIFF, 0, NULL, &diff,
1562 L_INFO(
" **** bad jpeg image: d = %d, diff = %5.2f ****\n",
1563 procName, depth, diff);
1573 if (cmap || d <= 16)
1577 depth = pixGetDepth(pix1);
1578 L_INFO(
"write/read webp\n", procName);
1579 pixWrite(FILE_WEBP, pix1, IFF_WEBP);
1581 pixCompareRGB(pix1, pix2, L_COMPARE_ABS_DIFF, 0, NULL, &diff, NULL, NULL);
1583 L_INFO(
" **** bad webp image: d = %d, diff = %5.2f ****\n",
1584 procName, depth, diff);
1598 depth = pixGetDepth(pix1);
1599 L_INFO(
"write/read jp2k\n", procName);
1600 pixWrite(FILE_JP2K, pix1, IFF_JP2);
1606 pixCompareRGB(pix1, pix2, L_COMPARE_ABS_DIFF, 0, NULL, &diff,
1609 fprintf(stderr,
"diff = %7.3f\n", diff);
1611 L_INFO(
" **** bad jp2k image: d = %d, diff = %5.2f ****\n",
1612 procName, depth, diff);
1619 if (problems == FALSE)
1620 L_INFO(
"All formats read and written OK!\n", procName);
l_ok writeImageFileInfo(const char *filename, FILE *fpout, l_int32 headeronly)
writeImageFileInfo()
l_ok readHeaderTiff(const char *filename, l_int32 n, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *pres, l_int32 *pcmap, l_int32 *pformat)
readHeaderTiff()
PIX * pixRemoveColormap(PIX *pixs, l_int32 type)
pixRemoveColormap()
PIX * pixReadStreamTiff(FILE *fp, l_int32 n)
pixReadStreamTiff()
l_int32 lept_mkdir(const char *subdir)
lept_mkdir()
l_ok fprintTiffInfo(FILE *fpout, const char *tiffile)
fprintTiffInfo()
l_ok readHeaderMemPng(const l_uint8 *data, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap)
readHeaderMemPng()
PIX * pixReadMemSpix(const l_uint8 *data, size_t size)
pixReadMemSpix()
PIX * pixReadStreamPng(FILE *fp)
pixReadStreamPng()
PIX * pixConvertTo32(PIX *pixs)
pixConvertTo32()
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()
PIXA * pixaReadFiles(const char *dirname, const char *substr)
pixaReadFiles()
PIX * pixReadStreamBmp(FILE *fp)
pixReadStreamBmp()
PIXA * pixaCreate(l_int32 n)
pixaCreate()
PIX * pixReadIndexed(SARRAY *sa, l_int32 index)
pixReadIndexed()
PIX * pixConvertTo8(PIX *pixs, l_int32 cmapflag)
pixConvertTo8()
l_ok pixcmapWriteStream(FILE *fp, PIXCMAP *cmap)
pixcmapWriteStream()
PIX * pixReadMemBmp(const l_uint8 *cdata, size_t size)
pixReadMemBmp()
void pixcmapDestroy(PIXCMAP **pcmap)
pixcmapDestroy()
l_ok readHeaderMemTiff(const l_uint8 *cdata, size_t size, l_int32 n, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *pres, l_int32 *pcmap, l_int32 *pformat)
readHeaderMemTiff()
PIX * pixReadMemPnm(const l_uint8 *data, size_t size)
pixReadMemPnm()
void l_pngSetReadStrip16To8(l_int32 flag)
l_pngSetReadStrip16To8()
PIX * pixReadMem(const l_uint8 *data, size_t size)
pixReadMem()
l_ok pixCompareRGB(PIX *pix1, PIX *pix2, l_int32 comptype, l_int32 plottype, l_int32 *psame, l_float32 *pdiff, l_float32 *prmsdiff, PIX **ppixdiff)
pixCompareRGB()
PIX * pixClipRectangle(PIX *pixs, BOX *box, BOX **pboxc)
pixClipRectangle()
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()
PIX * pixReadStreamPnm(FILE *fp)
pixReadStreamPnm()
l_ok pixSetText(PIX *pix, const char *textstring)
pixSetText()
PIX * pixReadMemJpeg(const l_uint8 *data, size_t size, l_int32 cmflag, l_int32 reduction, l_int32 *pnwarn, l_int32 hint)
pixReadMemJpeg()
l_ok findFileFormatStream(FILE *fp, l_int32 *pformat)
findFileFormatStream()
l_ok readHeaderMemJpeg(const l_uint8 *data, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pspp, l_int32 *pycck, l_int32 *pcmyk)
readHeaderMemJpeg()
l_ok readHeaderPng(const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap)
readHeaderPng()
l_ok pixCompareGray(PIX *pix1, PIX *pix2, l_int32 comptype, l_int32 plottype, l_int32 *psame, l_float32 *pdiff, l_float32 *prmsdiff, PIX **ppixdiff)
pixCompareGray()
l_ok pixaAddPix(PIXA *pixa, PIX *pix, l_int32 copyflag)
pixaAddPix()
PIX * pixReadStreamJpeg(FILE *fp, l_int32 cmapflag, l_int32 reduction, l_int32 *pnwarn, l_int32 hint)
pixReadStreamJpeg()
l_ok pixCountPixels(PIX *pixs, l_int32 *pcount, l_int32 *tab8)
pixCountPixels()
l_ok pixcmapIsValid(PIXCMAP *cmap, l_int32 *pvalid)
pixcmapIsValid()
size_t fnbytesInFile(FILE *fp)
fnbytesInFile()
PIX * pixReadStreamSpix(FILE *fp)
pixReadStreamSpix()
l_ok findFileFormat(const char *filename, l_int32 *pformat)
findFileFormat()
char * sarrayGetString(SARRAY *sa, l_int32 index, l_int32 copyflag)
sarrayGetString()
PIX * pixClone(PIX *pixs)
pixClone()
l_ok findFileFormatBuffer(const l_uint8 *buf, l_int32 *pformat)
findFileFormatBuffer()
void pixDestroy(PIX **ppix)
pixDestroy()
l_ok pixcmapHasColor(PIXCMAP *cmap, l_int32 *pcolor)
pixcmapHasColor()
PIX * pixReadStream(FILE *fp, l_int32 hint)
pixReadStream()
l_ok sreadHeaderSpix(const l_uint32 *data, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap)
sreadHeaderSpix()
SARRAY * getSortedPathnamesInDirectory(const char *dirname, const char *substr, l_int32 first, l_int32 nfiles)
getSortedPathnamesInDirectory()
PIX * pixReadMemTiff(const l_uint8 *cdata, size_t size, l_int32 n)
pixReadMemTiff()
PIXA * pixaReadFilesSA(SARRAY *sa)
pixaReadFilesSA()
l_ok pixGetDimensions(const PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
l_int32 fileFormatIsTiff(FILE *fp)
fileFormatIsTiff()
FILE * fopenReadStream(const char *filename)
fopenReadStream()
l_int32 sarrayGetCount(SARRAY *sa)
sarrayGetCount()
PIX * pixRead(const char *filename)
pixRead()
FILE * lept_fopen(const char *filename, const char *mode)
lept_fopen()
char * pixGetText(PIX *pix)
pixGetText()
PIX * pixReadWithHint(const char *filename, l_int32 hint)
pixReadWithHint()
l_ok findTiffCompression(FILE *fp, l_int32 *pcomptype)
findTiffCompression()
l_ok lept_fclose(FILE *fp)
lept_fclose()
l_ok pixReadHeaderMem(const l_uint8 *data, size_t size, l_int32 *pformat, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap)
pixReadHeaderMem()
PIX * pixDisplayLayersRGBA(PIX *pixs, l_uint32 val, l_int32 maxw)
pixDisplayLayersRGBA()
void boxDestroy(BOX **pbox)
boxDestroy()
l_ok pixEqual(PIX *pix1, PIX *pix2, l_int32 *psame)
pixEqual()
PIX * pixReadMemPng(const l_uint8 *filedata, size_t filesize)
pixReadMemPng()
l_ok readHeaderSpix(const char *filename, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap)
readHeaderSpix()
l_ok readHeaderJpeg(const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pspp, l_int32 *pycck, l_int32 *pcmyk)
readHeaderJpeg()
l_ok tiffGetCount(FILE *fp, l_int32 *pn)
tiffGetCount()
BOX * boxCreate(l_int32 x, l_int32 y, l_int32 w, l_int32 h)
boxCreate()
l_ok ioFormatTest(const char *filename)
ioFormatTest()
l_ok pixReadHeader(const char *filename, l_int32 *pformat, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap)
pixReadHeader()
void sarrayDestroy(SARRAY **psa)
sarrayDestroy()