mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 19:17:13 -05:00 
			
		
		
		
	Merge pull request #124 from bmartin5692/master
Added a density setting
This commit is contained in:
		
						commit
						7b88cea07b
					
				@ -61,6 +61,17 @@ PAPERLESS_SHARED_SECRET=""
 | 
				
			|||||||
# the web for "MAGICK_MEMORY_LIMIT".
 | 
					# the web for "MAGICK_MEMORY_LIMIT".
 | 
				
			||||||
#PAPERLESS_CONVERT_MEMORY_LIMIT=0
 | 
					#PAPERLESS_CONVERT_MEMORY_LIMIT=0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# By default the conversion density setting for documents is 300DPI, in some
 | 
				
			||||||
 | 
					# cases it has proven useful to configure a lesser value.
 | 
				
			||||||
 | 
					# This setting has a high impact on the physical size of tmp page files,
 | 
				
			||||||
 | 
					# the speed of document conversion, and can affect the accuracy of OCR
 | 
				
			||||||
 | 
					# results. Individual results can vary and this setting should be tested 
 | 
				
			||||||
 | 
					# thoroughly against the documents you are importing to see if it has any 
 | 
				
			||||||
 | 
					# impacts either negative or positive. Testing on limited document sets has
 | 
				
			||||||
 | 
					# shown a setting of 200 can cut the size of tmp files by 1/3, and speed up
 | 
				
			||||||
 | 
					# conversion by up to 4x with little impact to OCR accuracy.
 | 
				
			||||||
 | 
					#PAPERLESS_CONVERT_DENSITY=300
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Similar to the memory limit, if you've got a small system and your OS mounts
 | 
					# Similar to the memory limit, if you've got a small system and your OS mounts
 | 
				
			||||||
# /tmp as tmpfs, you should set this to a path that's on a physical disk, like
 | 
					# /tmp as tmpfs, you should set this to a path that's on a physical disk, like
 | 
				
			||||||
# /home/your_user/tmp or something.  ImageMagick will use this as scratch space
 | 
					# /home/your_user/tmp or something.  ImageMagick will use this as scratch space
 | 
				
			||||||
 | 
				
			|||||||
@ -53,6 +53,7 @@ class Consumer(object):
 | 
				
			|||||||
    UNPAPER = settings.UNPAPER_BINARY
 | 
					    UNPAPER = settings.UNPAPER_BINARY
 | 
				
			||||||
    CONSUME = settings.CONSUMPTION_DIR
 | 
					    CONSUME = settings.CONSUMPTION_DIR
 | 
				
			||||||
    THREADS = int(settings.OCR_THREADS) if settings.OCR_THREADS else None
 | 
					    THREADS = int(settings.OCR_THREADS) if settings.OCR_THREADS else None
 | 
				
			||||||
 | 
					    DENSITY = settings.CONVERT_DENSITY if settings.CONVERT_DENSITY else 300
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DEFAULT_OCR_LANGUAGE = settings.OCR_LANGUAGE
 | 
					    DEFAULT_OCR_LANGUAGE = settings.OCR_LANGUAGE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -158,7 +159,7 @@ class Consumer(object):
 | 
				
			|||||||
        pnm = os.path.join(tempdir, "convert-%04d.pnm")
 | 
					        pnm = os.path.join(tempdir, "convert-%04d.pnm")
 | 
				
			||||||
        run_convert(
 | 
					        run_convert(
 | 
				
			||||||
            self.CONVERT,
 | 
					            self.CONVERT,
 | 
				
			||||||
            "-density", "300",
 | 
					            "-density", str(self.DENSITY),
 | 
				
			||||||
            "-depth", "8",
 | 
					            "-depth", "8",
 | 
				
			||||||
            "-type", "grayscale",
 | 
					            "-type", "grayscale",
 | 
				
			||||||
            doc, pnm,
 | 
					            doc, pnm,
 | 
				
			||||||
 | 
				
			|||||||
@ -191,6 +191,7 @@ GNUPG_HOME = os.getenv("HOME", "/tmp")
 | 
				
			|||||||
CONVERT_BINARY = os.getenv("PAPERLESS_CONVERT_BINARY")
 | 
					CONVERT_BINARY = os.getenv("PAPERLESS_CONVERT_BINARY")
 | 
				
			||||||
CONVERT_TMPDIR = os.getenv("PAPERLESS_CONVERT_TMPDIR")
 | 
					CONVERT_TMPDIR = os.getenv("PAPERLESS_CONVERT_TMPDIR")
 | 
				
			||||||
CONVERT_MEMORY_LIMIT = os.getenv("PAPERLESS_CONVERT_MEMORY_LIMIT")
 | 
					CONVERT_MEMORY_LIMIT = os.getenv("PAPERLESS_CONVERT_MEMORY_LIMIT")
 | 
				
			||||||
 | 
					CONVERT_DENSITY = os.getenv("PAPERLESS_CONVERT_DENSITY")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Unpaper
 | 
					# Unpaper
 | 
				
			||||||
UNPAPER_BINARY = os.getenv("PAPERLESS_UNPAPER_BINARY", "unpaper")
 | 
					UNPAPER_BINARY = os.getenv("PAPERLESS_UNPAPER_BINARY", "unpaper")
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user