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

Commit

Permalink
Merge pull request #49 from pitkley/feature/detect-orientation
Browse files Browse the repository at this point in the history
Detect image orientation if the OCR supports it. Fixes #47
  • Loading branch information
danielquinn committed Feb 18, 2016
2 parents 1e7ece8 + c34d57a commit 57bcb88
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 57bcb88

Please sign in to comment.