diff --git a/src/documents/consumer.py b/src/documents/consumer.py index 98fedde09..12761e992 100644 --- a/src/documents/consumer.py +++ b/src/documents/consumer.py @@ -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)