mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-04 03:27:12 -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:
		
						commit
						57bcb883bf
					
				@ -28,6 +28,9 @@ from .languages import ISO639
 | 
			
		||||
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)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user