#1027985 tesseract-ocr: document gets rotated on its side when converting from jpg to pdf

Package:
tesseract-ocr
Source:
tesseract-ocr
Description:
Tesseract command line OCR tool
Submitter:
Date:
2023-01-05 15:12:04 UTC
Severity:
normal
#1027985#5
Date:
2023-01-05 15:09:35 UTC
From:
To:
When tesseract is fed a JPG image of an upright document and
instructed to produce a searchable PDF, it flips the image on its
side. The rotation apparently happens before OCR is performed judging
from the text produced (as pdf2txt shows it as one character per
line). This is the syntax used:

  $ tesseract color_document.jpg sideways_doc -l eng+nld pdf

The workaround is quite ugly:

  $ pdftk doc_sideways_doc.pdf cat 1-r1east output upright_doc.pdf
  $ ocrmypdf --force-ocr -l eng+nld upright_doc.pdf proper.pdf

I don’t think this bug affects every document. It’s perhaps trying to
be smart and detect the orientation of the doc & misjudging it. If
that’s true, it’s a shame that tesseract does this automatically and
beyond the control of the user. There is no option to force tesseract
to leave the orientation as-is.