mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-19 23:19:07 +08:00
Fix handling of single pages from multipage TIFF files (issue #2537)
That case now uses Leptonica to deliver the desired image instead of
using an inefficient loop in the Tesseract code.
See commit 54fafc4e2e
which used similar
code in the past.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
08ca7b8416
commit
22fb70cb85
@ -1037,10 +1037,14 @@ bool TessBaseAPI::ProcessPagesMultipageTiff(const l_uint8 *data,
|
||||
int page = (tessedit_page_number >= 0) ? tessedit_page_number : 0;
|
||||
size_t offset = 0;
|
||||
for (; ; ++page) {
|
||||
if (tessedit_page_number >= 0)
|
||||
if (tessedit_page_number >= 0) {
|
||||
page = tessedit_page_number;
|
||||
pix = (data) ? pixReadMemTiff(data, size, page)
|
||||
: pixReadTiff(filename, page);
|
||||
} else {
|
||||
pix = (data) ? pixReadMemFromMultipageTiff(data, size, &offset)
|
||||
: pixReadFromMultipageTiff(filename, &offset);
|
||||
}
|
||||
if (pix == nullptr) break;
|
||||
tprintf("Page %d\n", page + 1);
|
||||
char page_str[kMaxIntSize];
|
||||
|
Loading…
Reference in New Issue
Block a user