fix issue 307.

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@373 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
joregan 2010-05-26 23:07:57 +00:00
parent 5567959c0a
commit 428b1bb543

View File

@ -226,7 +226,17 @@ int main(int argc, char **argv) {
}
#ifdef HAVE_LIBLEPT
int page = page_number;
int npages = 0;
bool is_tiff = fileFormatIsTiff(fp);
if (is_tiff) {
int tiffstat = tiffGetCount(fp, &npages);
if (tiffstat == 1) {
fprintf (stderr, "Error reading file %s!\n", argv[1]);
fclose(fp);
exit(1);
}
//fprintf (stderr, "%d pages\n", npages);
}
fclose(fp);
Pix *pix;
@ -241,7 +251,7 @@ int main(int argc, char **argv) {
// Run tesseract on the page!
TesseractImage(argv[1], NULL, pix, page, &api, &text_out);
pixDestroy(&pix);
if (tessedit_page_number >= 0) {
if (tessedit_page_number >= 0 || npages == 1) {
break;
}
}