mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Merge pull request #49 from pitkley/feature/detect-orientation
Detect image orientation if the OCR supports it. Fixes #47
This commit is contained in:
		| @@ -28,6 +28,9 @@ from .languages import ISO639 | |||||||
| def image_to_string(args): | def image_to_string(args): | ||||||
|     self, png, lang = args |     self, png, lang = args | ||||||
|     with Image.open(os.path.join(self.SCRATCH, png)) as f: |     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) |         return self.OCR.image_to_string(f, lang=lang) | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Daniel Quinn
					Daniel Quinn