mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-04 09:49:16 +08:00
Merge pull request #2542 from stweil/tiff
Fix handling of single pages from multipage TIFF files (issue #2537)
This commit is contained in:
commit
67ad54ea20
@ -1036,20 +1036,13 @@ bool TessBaseAPI::ProcessPagesMultipageTiff(const l_uint8 *data,
|
|||||||
for (; ; ++page) {
|
for (; ; ++page) {
|
||||||
if (tessedit_page_number >= 0) {
|
if (tessedit_page_number >= 0) {
|
||||||
page = tessedit_page_number;
|
page = tessedit_page_number;
|
||||||
int pages_read = 0;
|
pix = (data) ? pixReadMemTiff(data, size, page)
|
||||||
do {
|
: pixReadTiff(filename, page);
|
||||||
pix = (data) ? pixReadMemFromMultipageTiff(data, size, &offset)
|
} else {
|
||||||
: pixReadFromMultipageTiff(filename, &offset);
|
|
||||||
pages_read++;
|
|
||||||
} while (pix != nullptr && pages_read < (page + 1));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pix = (data) ? pixReadMemFromMultipageTiff(data, size, &offset)
|
pix = (data) ? pixReadMemFromMultipageTiff(data, size, &offset)
|
||||||
: pixReadFromMultipageTiff(filename, &offset);
|
: pixReadFromMultipageTiff(filename, &offset);
|
||||||
}
|
|
||||||
if (pix == nullptr) {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
if (pix == nullptr) break;
|
||||||
tprintf("Page %d\n", page + 1);
|
tprintf("Page %d\n", page + 1);
|
||||||
char page_str[kMaxIntSize];
|
char page_str[kMaxIntSize];
|
||||||
snprintf(page_str, kMaxIntSize - 1, "%d", page);
|
snprintf(page_str, kMaxIntSize - 1, "%d", page);
|
||||||
|
Loading…
Reference in New Issue
Block a user