Multiple output formats
Author: ELToulemondeCreated Nov 6, 2018Updated May 1, 2025
LabelsFeature Request
Hi,
Tesseract feature Tesseract allows to make a single call and have multiple output format for example:
tesseract yourimage.tif out pdf tsvThis will generate an out.pdf and an out.tsv; hence at the same time retrieve OCR results in a readable format by python and a searchable pdf.
Doing both formats at the same time is interesting because according to my experiences it is twice faster. I believe that it is due to avoiding redoing the OCR computation.
Not possible with pytesseract But using this feature is not possible with pytesseract since you expose only specific functions (one for each task)
Potential solutions
- Edit function
image_to_pdf_or_hocrto make it accept extension such aspdf tsvMeaning modifying
if extension not in ['pdf', 'hocr']:
extension = 'txt'- Expose function
run_tesseractand (with some precaution onextension)run_and_get_output - Create a new specific function which handle list of formats
Source: madmaze/pytesseract