Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Detect image orientation if the OCR supports it
Browse files Browse the repository at this point in the history
Fixes issue #47.
  • Loading branch information
pitkley committed Feb 18, 2016
1 parent 1e7ece8 commit c34d57a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/documents/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
def image_to_string(args):
self, png, lang = args
with Image.open(os.path.join(self.SCRATCH, png)) as f:
if self.OCR.can_detect_orientation():
orientation = self.OCR.detect_orientation(f, lang=lang)
f = f.rotate(orientation["angle"], expand=1)
return self.OCR.image_to_string(f, lang=lang)


Expand Down

0 comments on commit c34d57a

Please sign in to comment.