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";
101 static const unsigned char JP2K_CODESTREAM[4] = { 0xff, 0x4f, 0xff, 0x51 };
102 static const unsigned char JP2K_IMAGE_DATA[12] = { 0x00, 0x00, 0x00, 0x0c,
103 0x6a, 0x50, 0x20, 0x20,
104 0x0d, 0x0a, 0x87, 0x0a };
133 PROCNAME(
"pixaReadFiles");
136 return (
PIXA *)ERROR_PTR(
"dirname not defined", procName, NULL);
139 return (
PIXA *)ERROR_PTR(
"sa not made", procName, NULL);
161 PROCNAME(
"pixaReadFilesSA");
164 return (
PIXA *)ERROR_PTR(
"sa not defined", procName, NULL);
168 for (i = 0; i < n; i++) {
170 if ((pix =
pixRead(str)) == NULL) {
171 L_WARNING(
"pix not read from file %s\n", procName, str);
201 return (
PIX *)ERROR_PTR(
"filename not defined", procName, NULL);
204 L_ERROR(
"image file not found: %s\n", procName, filename);
210 return (
PIX *)ERROR_PTR(
"pix not read", procName, NULL);
236 PROCNAME(
"pixReadWithHint");
239 return (
PIX *)ERROR_PTR(
"filename not defined", procName, NULL);
242 return (
PIX *)ERROR_PTR(
"image file not found", procName, NULL);
247 return (
PIX *)ERROR_PTR(
"image not returned", procName, NULL);
288 PROCNAME(
"pixReadIndexed");
291 return (
PIX *)ERROR_PTR(
"sa not defined", procName, NULL);
293 if (index < 0 || index >= n)
294 return (
PIX *)ERROR_PTR(
"index out of bounds", procName, NULL);
297 if (fname[0] ==
'\0')
300 if ((pix =
pixRead(fname)) == NULL) {
301 L_ERROR(
"pix not read from file %s\n", procName, fname);
325 l_int32 format, ret, valid;
330 PROCNAME(
"pixReadStream");
333 return (
PIX *)ERROR_PTR(
"stream not defined", procName, NULL);
341 return (
PIX *)ERROR_PTR(
"bmp: no pix returned", procName, NULL);
346 return (
PIX *)ERROR_PTR(
"jpeg: no pix returned", procName, NULL);
347 ret = fgetJpegComment(fp, &comment);
355 return (
PIX *)ERROR_PTR(
"png: no pix returned", procName, NULL);
359 case IFF_TIFF_PACKBITS:
367 return (
PIX *)ERROR_PTR(
"tiff: no pix returned", procName, NULL);
372 return (
PIX *)ERROR_PTR(
"pnm: no pix returned", procName, NULL);
376 if ((pix = pixReadStreamGif(fp)) == NULL)
377 return (
PIX *)ERROR_PTR(
"gif: no pix returned", procName, NULL);
381 if ((pix = pixReadStreamJp2k(fp, 1, NULL, 0, 0)) == NULL)
382 return (
PIX *)ERROR_PTR(
"jp2: no pix returned", procName, NULL);
386 if ((pix = pixReadStreamWebP(fp)) == NULL)
387 return (
PIX *)ERROR_PTR(
"webp: no pix returned", procName, NULL);
391 L_ERROR(
"PostScript reading is not supported\n", procName);
395 L_ERROR(
"Pdf reading is not supported\n", procName);
400 return (
PIX *)ERROR_PTR(
"spix: no pix returned", procName, NULL);
404 return (
PIX *)ERROR_PTR(
"Unknown format: no pix returned",
410 pixSetInputFormat(pix, format);
411 if ((cmap = pixGetColormap(pix))) {
415 return (
PIX *)ERROR_PTR(
"invalid colormap", procName, NULL);
454 l_int32 format, ret, w, h, d, bps, spp, iscmap;
459 PROCNAME(
"pixReadHeader");
465 if (piscmap) *piscmap = 0;
466 if (pformat) *pformat = 0;
469 return ERROR_INT(
"filename not defined", procName, 1);
472 return ERROR_INT(
"image file not found", procName, 1);
479 if ((pix =
pixRead(filename)) == NULL)
480 return ERROR_INT(
"bmp: pix not read", procName, 1);
482 if (pixGetColormap(pix))
485 bps = (d == 32) ? 8 : d;
486 spp = (d == 32) ? 3 : 1;
493 return ERROR_INT(
"jpeg: no header info returned", procName, 1);
499 return ERROR_INT(
"png: no header info returned", procName, 1);
503 case IFF_TIFF_PACKBITS:
511 ret =
readHeaderTiff(filename, 0, &w, &h, &bps, &spp, NULL, &iscmap,
514 return ERROR_INT(
"tiff: no header info returned", procName, 1);
518 ret =
readHeaderPnm(filename, &w, &h, &d, &type, &bps, &spp);
520 return ERROR_INT(
"pnm: no header info returned", procName, 1);
524 if ((pix =
pixRead(filename)) == NULL)
525 return ERROR_INT(
"gif: pix not read", procName, 1);
538 if (readHeaderWebP(filename, &w, &h, &spp))
539 return ERROR_INT(
"webp: no header info returned", procName, 1);
544 if (pformat) *pformat = format;
545 return ERROR_INT(
"PostScript reading is not supported\n", procName, 1);
548 if (pformat) *pformat = format;
549 return ERROR_INT(
"Pdf reading is not supported\n", procName, 1);
554 return ERROR_INT(
"spix: no header info returned", procName, 1);
558 L_ERROR(
"unknown format in file %s\n", procName, filename);
565 if (pbps) *pbps = bps;
566 if (pspp) *pspp = spp;
567 if (piscmap) *piscmap = iscmap;
568 if (pformat) *pformat = format;
590 PROCNAME(
"findFileFormat");
593 return ERROR_INT(
"&format not defined", procName, 1);
594 *pformat = IFF_UNKNOWN;
596 return ERROR_INT(
"filename not defined", procName, 1);
599 return ERROR_INT(
"image file not found", procName, 1);
622 l_uint8 firstbytes[13];
625 PROCNAME(
"findFileFormatStream");
628 return ERROR_INT(
"&format not defined", procName, 1);
629 *pformat = IFF_UNKNOWN;
631 return ERROR_INT(
"stream not defined", procName, 1);
635 return ERROR_INT(
"truncated file", procName, 1);
637 if (fread(&firstbytes, 1, 12, fp) != 12)
638 return ERROR_INT(
"failed to read first 12 bytes of file", procName, 1);
643 if (format == IFF_TIFF) {
648 if (format == IFF_UNKNOWN)
676 PROCNAME(
"findFileFormatBuffer");
679 return ERROR_INT(
"&format not defined", procName, 1);
680 *pformat = IFF_UNKNOWN;
682 return ERROR_INT(
"byte buffer not defined", procName, 0);
685 ((
char *)(&twobytepw))[0] = buf[0];
686 ((
char *)(&twobytepw))[1] = buf[1];
688 if (convertOnBigEnd16(twobytepw) ==
BMP_ID) {
699 if ((buf[0] ==
'P' && buf[1] ==
'4') ||
700 (buf[0] ==
'P' && buf[1] ==
'1')) {
705 if ((buf[0] ==
'P' && buf[1] ==
'5') ||
706 (buf[0] ==
'P' && buf[1] ==
'2')) {
711 if ((buf[0] ==
'P' && buf[1] ==
'6') ||
712 (buf[0] ==
'P' && buf[1] ==
'3')) {
717 if (buf[0] ==
'P' && buf[1] ==
'7') {
733 if (buf[0] == 0xff && buf[1] == 0xd8) {
734 *pformat = IFF_JFIF_JPEG;
740 if (buf[0] == 137 && buf[1] == 80 && buf[2] == 78 && buf[3] == 71 &&
741 buf[4] == 13 && buf[5] == 10 && buf[6] == 26 && buf[7] == 10) {
747 if (buf[0] ==
'G' && buf[1] ==
'I' && buf[2] ==
'F' && buf[3] ==
'8' &&
748 (buf[4] ==
'7' || buf[4] ==
'9') && buf[5] ==
'a') {
754 if (memcmp(buf, JP2K_CODESTREAM, 4) == 0 ||
755 memcmp(buf, JP2K_IMAGE_DATA, 12) == 0) {
761 if (buf[0] ==
'R' && buf[1] ==
'I' && buf[2] ==
'F' && buf[3] ==
'F' &&
762 buf[8] ==
'W' && buf[9] ==
'E' && buf[10] ==
'B' && buf[11] ==
'P') {
768 if (buf[0] ==
'%' && buf[1] ==
'!' && buf[2] ==
'P' && buf[3] ==
'S' &&
769 buf[4] ==
'-' && buf[5] ==
'A' && buf[6] ==
'd' && buf[7] ==
'o' &&
770 buf[8] ==
'b' && buf[9] ==
'e') {
776 if (buf[0] ==
'%' && buf[1] ==
'P' && buf[2] ==
'D' && buf[3] ==
'F' &&
777 buf[4] ==
'-' && buf[5] ==
'1') {
783 if (buf[0] ==
's' && buf[1] ==
'p' && buf[2] ==
'i' && buf[3] ==
'x') {
804 PROCNAME(
"fileFormatIsTiff");
807 return ERROR_INT(
"stream not defined", procName, 0);
810 if (format == IFF_TIFF || format == IFF_TIFF_PACKBITS ||
811 format == IFF_TIFF_RLE || format == IFF_TIFF_G3 ||
812 format == IFF_TIFF_G4 || format == IFF_TIFF_LZW ||
813 format == IFF_TIFF_ZIP || format == IFF_TIFF_JPEG)
847 l_int32 format, valid;
851 PROCNAME(
"pixReadMem");
854 return (
PIX *)ERROR_PTR(
"data not defined", procName, NULL);
856 return (
PIX *)ERROR_PTR(
"size < 12", procName, NULL);
864 return (
PIX *)ERROR_PTR(
"bmp: no pix returned", procName, NULL);
869 return (
PIX *)ERROR_PTR(
"jpeg: no pix returned", procName, NULL);
874 return (
PIX *)ERROR_PTR(
"png: no pix returned", procName, NULL);
878 case IFF_TIFF_PACKBITS:
886 return (
PIX *)ERROR_PTR(
"tiff: no pix returned", procName, NULL);
891 return (
PIX *)ERROR_PTR(
"pnm: no pix returned", procName, NULL);
895 if ((pix = pixReadMemGif(data, size)) == NULL)
896 return (
PIX *)ERROR_PTR(
"gif: no pix returned", procName, NULL);
900 if ((pix = pixReadMemJp2k(data, size, 1, NULL, 0, 0)) == NULL)
901 return (
PIX *)ERROR_PTR(
"jp2k: no pix returned", procName, NULL);
905 if ((pix = pixReadMemWebP(data, size)) == NULL)
906 return (
PIX *)ERROR_PTR(
"webp: no pix returned", procName, NULL);
910 L_ERROR(
"PostScript reading is not supported\n", procName);
914 L_ERROR(
"Pdf reading is not supported\n", procName);
919 return (
PIX *)ERROR_PTR(
"spix: no pix returned", procName, NULL);
923 return (
PIX *)ERROR_PTR(
"Unknown format: no pix returned",
932 if (format == IFF_TIFF && pixGetDepth(pix) == 1)
933 format = IFF_TIFF_G4;
934 pixSetInputFormat(pix, format);
935 if ((cmap = pixGetColormap(pix))) {
939 return (
PIX *)ERROR_PTR(
"invalid colormap", procName, NULL);
983 l_int32 format, ret, w, h, d, bps, spp, iscmap;
987 PROCNAME(
"pixReadHeaderMem");
993 if (piscmap) *piscmap = 0;
994 if (pformat) *pformat = 0;
997 return ERROR_INT(
"data not defined", procName, 1);
999 return ERROR_INT(
"size < 12", procName, 1);
1007 return ERROR_INT(
"bmp: pix not read", procName, 1);
1010 bps = (d == 32) ? 8 : d;
1011 spp = (d == 32) ? 3 : 1;
1018 return ERROR_INT(
"jpeg: no header info returned", procName, 1);
1024 return ERROR_INT(
"png: no header info returned", procName, 1);
1028 case IFF_TIFF_PACKBITS:
1037 NULL, &iscmap, &format);
1039 return ERROR_INT(
"tiff: no header info returned", procName, 1);
1045 return ERROR_INT(
"pnm: no header info returned", procName, 1);
1049 if ((pix = pixReadMemGif(data, size)) == NULL)
1050 return ERROR_INT(
"gif: pix not read", procName, 1);
1064 ret = readHeaderMemWebP(data, size, &w, &h, &spp);
1068 if (pformat) *pformat = format;
1069 return ERROR_INT(
"PostScript reading is not supported\n", procName, 1);
1072 if (pformat) *pformat = format;
1073 return ERROR_INT(
"Pdf reading is not supported\n", procName, 1);
1079 return ERROR_INT(
"pnm: no header info returned", procName, 1);
1083 return ERROR_INT(
"unknown format; no data returned", procName, 1);
1089 if (pbps) *pbps = bps;
1090 if (pspp) *pspp = spp;
1091 if (piscmap) *piscmap = iscmap;
1092 if (pformat) *pformat = format;
1100 extern const char *ImageFileFormatExtensions[];
1126 l_int32 w, h, d, wpl, count, npages, color;
1127 l_int32 format, bps, spp, iscmap, xres, yres, transparency;
1132 PROCNAME(
"writeImageFileInfo");
1135 return ERROR_INT(
"filename not defined", procName, 1);
1137 return ERROR_INT(
"stream not defined", procName, 1);
1140 if (
pixReadHeader(filename, &format, &w, &h, &bps, &spp, &iscmap)) {
1141 L_ERROR(
"failure to read header of %s\n", procName, filename);
1144 fprintf(fpout,
"===============================================\n"
1145 "Reading the header:\n");
1146 fprintf(fpout,
" input image format type: %s\n",
1147 ImageFileFormatExtensions[format]);
1148 fprintf(fpout,
" w = %d, h = %d, bps = %d, spp = %d, iscmap = %d\n",
1149 w, h, bps, spp, iscmap);
1152 if (format == IFF_JP2) {
1154 fgetJp2kResolution(fpin, &xres, &yres);
1156 fprintf(fpout,
" xres = %d, yres = %d\n", xres, yres);
1157 }
else if (format == IFF_PNG) {
1159 fgetPngResolution(fpin, &xres, &yres);
1161 fprintf(fpout,
" xres = %d, yres = %d\n", xres, yres);
1164 fgetPngColormapInfo(fpin, &cmap, &transparency);
1167 fprintf(fpout,
" colormap has transparency\n");
1169 fprintf(fpout,
" colormap does not have transparency\n");
1173 }
else if (format == IFF_JFIF_JPEG) {
1175 fgetJpegResolution(fpin, &xres, &yres);
1177 fprintf(fpout,
" xres = %d, yres = %d\n", xres, yres);
1185 fprintf(fpout,
"===============================================\n"
1186 "Reading the full image:\n");
1189 if (format == IFF_PNG && bps == 16)
1192 if ((pix =
pixRead(filename)) == NULL) {
1193 L_ERROR(
"failure to read full image of %s\n", procName, filename);
1197 format = pixGetInputFormat(pix);
1199 wpl = pixGetWpl(pix);
1200 spp = pixGetSpp(pix);
1201 fprintf(fpout,
" input image format type: %s\n",
1202 ImageFileFormatExtensions[format]);
1203 fprintf(fpout,
" w = %d, h = %d, d = %d, spp = %d, wpl = %d\n",
1205 fprintf(fpout,
" xres = %d, yres = %d\n",
1206 pixGetXRes(pix), pixGetYRes(pix));
1210 fprintf(fpout,
" text: %s\n", text);
1212 cmap = pixGetColormap(pix);
1216 fprintf(fpout,
" colormap exists and has color values:");
1218 fprintf(fpout,
" colormap exists and has only gray values:");
1222 fprintf(fpout,
" colormap does not exist\n");
1224 if (format == IFF_TIFF || format == IFF_TIFF_G4 ||
1225 format == IFF_TIFF_G3 || format == IFF_TIFF_PACKBITS) {
1226 fprintf(fpout,
" Tiff header information:\n");
1231 fprintf(fpout,
" One page in file\n");
1233 fprintf(fpout,
" %d pages in file\n", npages);
1240 fprintf(fpout,
" 1 bpp: foreground pixel fraction ON/Total = %g\n",
1241 (l_float32)count / (l_float32)(w * h));
1243 fprintf(fpout,
"===============================================\n");
1249 if (pixGetSpp(pix) == 4) {
1251 pixDisplay(pixt, 100, 100);
1255 if (format == IFF_PNG && bps == 16)
1291 l_int32 w, h, d, depth, equal, problems;
1294 PIX *pixs, *pixc, *pix1, *pix2;
1297 PROCNAME(
"ioFormatTest");
1300 return ERROR_INT(
"filename not defined", procName, 1);
1303 if ((pix1 =
pixRead(filename)) == NULL)
1304 return ERROR_INT(
"pix1 not made", procName, 1);
1306 if (w > 250 && h > 250) {
1307 box =
boxCreate(w / 2 - 125, h / 2 - 125, 250, 250);
1326 if (pixGetSpp(pixc) == 4)
1328 cmap = pixGetColormap(pixc);
1329 d = pixGetDepth(pixc);
1340 if (d == 1 || d == 8) {
1341 L_INFO(
"write/read bmp\n", procName);
1342 pixWrite(FILE_BMP, pixc, IFF_BMP);
1350 L_INFO(
" **** bad bmp image: d = %d ****\n", procName, d);
1357 if (d == 2 || d == 4 || d == 32) {
1358 L_INFO(
"write/read bmp\n", procName);
1359 pixWrite(FILE_BMP, pixc, IFF_BMP);
1363 L_INFO(
" **** bad bmp image: d = %d ****\n", procName, d);
1374 L_INFO(
"write/read png\n", procName);
1375 pixWrite(FILE_PNG, pixc, IFF_PNG);
1379 L_INFO(
" **** bad png image: d = %d ****\n", procName, d);
1398 L_INFO(
"write/read uncompressed tiff\n", procName);
1399 pixWrite(FILE_TIFF, pixc, IFF_TIFF);
1403 L_INFO(
" **** bad tiff uncompressed image: d = %d ****\n",
1410 L_INFO(
"write/read lzw compressed tiff\n", procName);
1411 pixWrite(FILE_LZW, pixc, IFF_TIFF_LZW);
1415 L_INFO(
" **** bad tiff lzw compressed image: d = %d ****\n",
1422 L_INFO(
"write/read zip compressed tiff\n", procName);
1423 pixWrite(FILE_ZIP, pixc, IFF_TIFF_ZIP);
1427 L_INFO(
" **** bad tiff zip compressed image: d = %d ****\n",
1434 if (d == 8 || d == 32) {
1436 L_INFO(
"write/read jpeg compressed tiff\n", procName);
1437 if (d == 8 && pixGetColormap(pixc)) {
1439 pixWrite(FILE_TIFF_JPEG, pixc1, IFF_TIFF_JPEG);
1440 if ((pix1 =
pixRead(FILE_TIFF_JPEG)) == NULL) {
1441 L_INFO(
" did not read FILE_TIFF_JPEG\n", procName);
1446 pixWrite(FILE_TIFF_JPEG, pixc, IFF_TIFF_JPEG);
1447 pix1 =
pixRead(FILE_TIFF_JPEG);
1452 pixCompareRGB(pix1, pixc, L_COMPARE_ABS_DIFF, 0, NULL, &diff,
1456 L_INFO(
" **** bad tiff jpeg compressed image: "
1457 "d = %d, diff = %5.2f ****\n", procName, d, diff);
1466 L_INFO(
"write/read g4 compressed tiff\n", procName);
1467 pixWrite(FILE_G4, pixc, IFF_TIFF_G4);
1471 L_INFO(
" **** bad tiff g4 image ****\n", procName);
1476 L_INFO(
"write/read g3 compressed tiff\n", procName);
1477 pixWrite(FILE_G3, pixc, IFF_TIFF_G3);
1481 L_INFO(
" **** bad tiff g3 image ****\n", procName);
1486 L_INFO(
"write/read rle compressed tiff\n", procName);
1487 pixWrite(FILE_RLE, pixc, IFF_TIFF_RLE);
1491 L_INFO(
" **** bad tiff rle image: d = %d ****\n", procName, d);
1496 L_INFO(
"write/read packbits compressed tiff\n", procName);
1497 pixWrite(FILE_PB, pixc, IFF_TIFF_PACKBITS);
1501 L_INFO(
" **** bad tiff packbits image: d = %d ****\n",
1515 L_INFO(
"write/read pnm\n", procName);
1516 pixWrite(FILE_PNM, pixc, IFF_PNM);
1524 L_INFO(
" **** bad pnm image: d = %d ****\n", procName, d);
1533 if (d != 8 || !cmap)
1537 L_INFO(
"write/read gif\n", procName);
1538 pixWrite(FILE_GIF, pix1, IFF_GIF);
1542 L_INFO(
" **** bad gif image: d = %d ****\n", procName, d);
1556 depth = pixGetDepth(pix1);
1557 L_INFO(
"write/read jpeg\n", procName);
1558 pixWrite(FILE_JPG, pix1, IFF_JFIF_JPEG);
1564 pixCompareRGB(pix1, pix2, L_COMPARE_ABS_DIFF, 0, NULL, &diff,
1568 L_INFO(
" **** bad jpeg image: d = %d, diff = %5.2f ****\n",
1569 procName, depth, diff);
1579 if (cmap || d <= 16)
1583 depth = pixGetDepth(pix1);
1584 L_INFO(
"write/read webp\n", procName);
1585 pixWrite(FILE_WEBP, pix1, IFF_WEBP);
1587 pixCompareRGB(pix1, pix2, L_COMPARE_ABS_DIFF, 0, NULL, &diff, NULL, NULL);
1589 L_INFO(
" **** bad webp image: d = %d, diff = %5.2f ****\n",
1590 procName, depth, diff);
1604 depth = pixGetDepth(pix1);
1605 L_INFO(
"write/read jp2k\n", procName);
1606 pixWrite(FILE_JP2K, pix1, IFF_JP2);
1612 pixCompareRGB(pix1, pix2, L_COMPARE_ABS_DIFF, 0, NULL, &diff,
1617 L_INFO(
" **** bad jp2k image: d = %d, diff = %5.2f ****\n",
1618 procName, depth, diff);
1625 if (problems == FALSE)
1626 L_INFO(
"All formats read and written OK!\n", procName);
PIX * pixReadMemBmp(const l_uint8 *cdata, size_t size)
pixReadMemBmp()
PIX * pixReadStreamBmp(FILE *fp)
pixReadStreamBmp()
void boxDestroy(BOX **pbox)
boxDestroy()
BOX * boxCreate(l_int32 x, l_int32 y, l_int32 w, l_int32 h)
boxCreate()
void pixcmapDestroy(PIXCMAP **pcmap)
pixcmapDestroy()
l_ok pixcmapHasColor(PIXCMAP *cmap, l_int32 *pcolor)
pixcmapHasColor()
l_ok pixcmapIsValid(const PIXCMAP *cmap, PIX *pix, l_int32 *pvalid)
pixcmapIsValid()
l_ok pixcmapWriteStream(FILE *fp, const PIXCMAP *cmap)
pixcmapWriteStream()
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()
l_ok pixEqual(PIX *pix1, PIX *pix2, l_int32 *psame)
pixEqual()
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()
PIX * pixReadStreamJpeg(FILE *fp, l_int32 cmapflag, l_int32 reduction, l_int32 *pnwarn, l_int32 hint)
pixReadStreamJpeg()
PIX * pixReadMemJpeg(const l_uint8 *data, size_t size, l_int32 cmflag, l_int32 reduction, l_int32 *pnwarn, l_int32 hint)
pixReadMemJpeg()
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 readHeaderJpeg(const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pspp, l_int32 *pycck, l_int32 *pcmyk)
readHeaderJpeg()
void pixDestroy(PIX **ppix)
pixDestroy()
l_ok pixGetDimensions(const PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
char * pixGetText(PIX *pix)
pixGetText()
l_ok pixSetText(PIX *pix, const char *textstring)
pixSetText()
PIX * pixClone(PIX *pixs)
pixClone()
PIX * pixDisplayLayersRGBA(PIX *pixs, l_uint32 val, l_int32 maxw)
pixDisplayLayersRGBA()
l_ok pixSetPadBits(PIX *pix, l_int32 val)
pixSetPadBits()
l_ok pixCountPixels(PIX *pixs, l_int32 *pcount, l_int32 *tab8)
pixCountPixels()
PIX * pixClipRectangle(PIX *pixs, BOX *box, BOX **pboxc)
pixClipRectangle()
@ REMOVE_CMAP_BASED_ON_SRC
l_ok pixaAddPix(PIXA *pixa, PIX *pix, l_int32 copyflag)
pixaAddPix()
PIXA * pixaCreate(l_int32 n)
pixaCreate()
PIX * pixRemoveColormap(PIX *pixs, l_int32 type)
pixRemoveColormap()
PIX * pixConvertTo8(PIX *pixs, l_int32 cmapflag)
pixConvertTo8()
PIX * pixConvertTo32(PIX *pixs)
pixConvertTo32()
l_ok readHeaderPng(const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap)
readHeaderPng()
PIX * pixReadMemPng(const l_uint8 *filedata, size_t filesize)
pixReadMemPng()
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()
void l_pngSetReadStrip16To8(l_int32 flag)
l_pngSetReadStrip16To8()
PIX * pixReadStreamPng(FILE *fp)
pixReadStreamPng()
PIX * pixReadMemPnm(const l_uint8 *data, size_t size)
pixReadMemPnm()
PIX * pixReadStreamPnm(FILE *fp)
pixReadStreamPnm()
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 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()
PIXA * pixaReadFilesSA(SARRAY *sa)
pixaReadFilesSA()
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()
l_ok findFileFormat(const char *filename, l_int32 *pformat)
findFileFormat()
PIX * pixReadWithHint(const char *filename, l_int32 hint)
pixReadWithHint()
l_ok writeImageFileInfo(const char *filename, FILE *fpout, l_int32 headeronly)
writeImageFileInfo()
l_ok findFileFormatStream(FILE *fp, l_int32 *pformat)
findFileFormatStream()
PIXA * pixaReadFiles(const char *dirname, const char *substr)
pixaReadFiles()
l_ok findFileFormatBuffer(const l_uint8 *buf, l_int32 *pformat)
findFileFormatBuffer()
PIX * pixReadMem(const l_uint8 *data, size_t size)
pixReadMem()
PIX * pixRead(const char *filename)
pixRead()
PIX * pixReadIndexed(SARRAY *sa, l_int32 index)
pixReadIndexed()
l_ok ioFormatTest(const char *filename)
ioFormatTest()
l_int32 fileFormatIsTiff(FILE *fp)
fileFormatIsTiff()
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 * pixReadStream(FILE *fp, l_int32 hint)
pixReadStream()
char * sarrayGetString(SARRAY *sa, l_int32 index, l_int32 copyflag)
sarrayGetString()
l_int32 sarrayGetCount(SARRAY *sa)
sarrayGetCount()
void sarrayDestroy(SARRAY **psa)
sarrayDestroy()
SARRAY * getSortedPathnamesInDirectory(const char *dirname, const char *substr, l_int32 first, l_int32 nfiles)
getSortedPathnamesInDirectory()
PIX * pixReadStreamSpix(FILE *fp)
pixReadStreamSpix()
PIX * pixReadMemSpix(const l_uint8 *data, size_t size)
pixReadMemSpix()
l_ok readHeaderSpix(const char *filename, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap)
readHeaderSpix()
l_ok sreadHeaderSpix(const l_uint32 *data, size_t size, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap)
sreadHeaderSpix()
l_ok fprintTiffInfo(FILE *fpout, const char *tiffile)
fprintTiffInfo()
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()
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()
l_ok findTiffCompression(FILE *fp, l_int32 *pcomptype)
findTiffCompression()
PIX * pixReadMemTiff(const l_uint8 *cdata, size_t size, l_int32 n)
pixReadMemTiff()
PIX * pixReadStreamTiff(FILE *fp, l_int32 n)
pixReadStreamTiff()
l_ok tiffGetCount(FILE *fp, l_int32 *pn)
tiffGetCount()
void lept_stderr(const char *fmt,...)
lept_stderr()
l_ok lept_fclose(FILE *fp)
lept_fclose()
size_t fnbytesInFile(FILE *fp)
fnbytesInFile()
FILE * lept_fopen(const char *filename, const char *mode)
lept_fopen()
l_int32 lept_mkdir(const char *subdir)
lept_mkdir()
FILE * fopenReadStream(const char *filename)
fopenReadStream()