From 7fc9a34f796809a8ede8efb02c46091e1fa61103 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 1 Sep 2021 14:16:05 +0200 Subject: [PATCH] Rename processed TIFF output file and add page number if needed (fixes issue #3544) Signed-off-by: Stefan Weil --- doc/tesseract.1.asc | 2 +- src/api/baseapi.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/tesseract.1.asc b/doc/tesseract.1.asc index a54bba02..8d1e16f7 100644 --- a/doc/tesseract.1.asc +++ b/doc/tesseract.1.asc @@ -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`). diff --git a/src/api/baseapi.cpp b/src/api/baseapi.cpp index f602b04b..34d40be9 100644 --- a/src/api/baseapi.cpp +++ b/src/api/baseapi.cpp @@ -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') {