Rename processed TIFF output file and add page number if needed (fixes issue #3544)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2021-09-01 14:16:05 +02:00
parent 40fdacd485
commit 7fc9a34f79
2 changed files with 7 additions and 2 deletions

View File

@ -107,7 +107,7 @@ OPTIONS
* *pdf* -- Output PDF ('OUTPUTBASE'`.pdf`).
* *tsv* -- Output TSV ('OUTPUTBASE'`.tsv`).
* *txt* -- Output plain text ('OUTPUTBASE'`.txt`).
* *get.images* -- Write processed input images to file (`tessinput.tif`).
* *get.images* -- Write processed input images to file ('OUTPUTBASE'`.processedPAGENUMBER.tif`).
* *logfile* -- Redirect debug messages to file (`tesseract.log`).
* *lstm.train* -- Output files used by LSTM training ('OUTPUTBASE'`.lstmf`).
* *makebox* -- Write box file ('OUTPUTBASE'`.box`).

View File

@ -1276,7 +1276,12 @@ bool TessBaseAPI::ProcessPage(Pix *pix, int page_index, const char *filename,
if (tesseract_->tessedit_write_images) {
Pix *page_pix = GetThresholdedImage();
pixWrite("tessinput.tif", page_pix, IFF_TIFF_G4);
std::string output_filename = output_file_ + ".processed";
if (page_index > 0) {
output_filename += std::to_string(page_index);
}
output_filename += ".tif";
pixWrite(output_filename.c_str(), page_pix, IFF_TIFF_G4);
}
if (failed && retry_config != nullptr && retry_config[0] != '\0') {