mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	extract OCR_MAX_IMAGE_PIXELS into settings.py
This commit is contained in:
		
				
					committed by
					
						
						Johann Bauer
					
				
			
			
				
	
			
			
			
						parent
						
							95199bd325
						
					
				
				
					commit
					3b4da70c85
				
			@@ -489,6 +489,10 @@ OCR_ROTATE_PAGES_THRESHOLD = float(
 | 
				
			|||||||
    os.getenv("PAPERLESS_OCR_ROTATE_PAGES_THRESHOLD", 12.0),
 | 
					    os.getenv("PAPERLESS_OCR_ROTATE_PAGES_THRESHOLD", 12.0),
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OCR_MAX_IMAGE_PIXELS = os.environ.get(
 | 
				
			||||||
 | 
					    'PAPERLESS_OCR_MAX_IMAGE_PIXELS', Image.MAX_IMAGE_PIXELS
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OCR_USER_ARGS = os.getenv("PAPERLESS_OCR_USER_ARGS", "{}")
 | 
					OCR_USER_ARGS = os.getenv("PAPERLESS_OCR_USER_ARGS", "{}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# GNUPG needs a home directory for some reason
 | 
					# GNUPG needs a home directory for some reason
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,9 +8,7 @@ from documents.parsers import make_thumbnail_from_pdf
 | 
				
			|||||||
from documents.parsers import ParseError
 | 
					from documents.parsers import ParseError
 | 
				
			||||||
from PIL import Image
 | 
					from PIL import Image
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Image.MAX_IMAGE_PIXELS = os.environ.get(
 | 
					Image.MAX_IMAGE_PIXELS = settings.OCR_MAX_IMAGE_PIXELS
 | 
				
			||||||
    'PAPERLESS_OCR_MAX_IMAGE_PIXELS', Image.MAX_IMAGE_PIXELS
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class NoTextFoundException(Exception):
 | 
					class NoTextFoundException(Exception):
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,9 +6,7 @@ from PIL import Image
 | 
				
			|||||||
from PIL import ImageDraw
 | 
					from PIL import ImageDraw
 | 
				
			||||||
from PIL import ImageFont
 | 
					from PIL import ImageFont
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Image.MAX_IMAGE_PIXELS = os.environ.get(
 | 
					Image.MAX_IMAGE_PIXELS = settings.OCR_MAX_IMAGE_PIXELS
 | 
				
			||||||
    'PAPERLESS_OCR_MAX_IMAGE_PIXELS', Image.MAX_IMAGE_PIXELS
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TextDocumentParser(DocumentParser):
 | 
					class TextDocumentParser(DocumentParser):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user