Added the configuration option CONVERTER_GM_SETTINGS to pass GraphicsMagicks specific commands the the GM backend
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import subprocess
|
||||
|
||||
from converter.conf.settings import GM_PATH
|
||||
from converter.conf.settings import GM_SETTINGS
|
||||
from converter.api import QUALITY_DEFAULT, QUALITY_SETTINGS
|
||||
from converter.exceptions import ConvertError, UnknownFormat, IdentifyError
|
||||
|
||||
@@ -25,6 +26,7 @@ def execute_convert(input_filepath, output_filepath, quality=QUALITY_DEFAULT, ar
|
||||
command.append(unicode(GM_PATH))
|
||||
command.append(u'convert')
|
||||
command.extend(unicode(QUALITY_SETTINGS[quality]).split())
|
||||
command.extend(unicode(GM_SETTINGS).split())
|
||||
command.append(unicode(input_filepath))
|
||||
if arguments:
|
||||
command.extend(unicode(arguments).split())
|
||||
|
||||
@@ -6,6 +6,7 @@ IM_CONVERT_PATH = getattr(settings, 'CONVERTER_IM_ONVERT_PATH', u'/usr/bin/conve
|
||||
IM_IDENTIFY_PATH = getattr(settings, 'CONVERTER_IM_IDENTIFY_PATH', u'/usr/bin/identify')
|
||||
UNPAPER_PATH = getattr(settings, 'CONVERTER_UNPAPER_PATH', u'/usr/bin/unpaper')
|
||||
GM_PATH = getattr(settings, 'CONVERTER_GM_PATH', u'/usr/bin/gm')
|
||||
GM_SETTINGS = getattr(settings, 'CONVERTER_GM_SETTINGS', u'')
|
||||
GRAPHICS_BACKEND = getattr(settings, 'CONVERTER_GRAPHICS_BACKEND', u'converter.backends.imagemagick')
|
||||
|
||||
OCR_OPTIONS = getattr(settings, 'CONVERTER_OCR_OPTIONS', u'-colorspace Gray -depth 8 -resample 200x200')
|
||||
|
||||
@@ -68,18 +68,19 @@ def check_settings(request):
|
||||
'description': common_settings.setting_description},
|
||||
|
||||
# Converter
|
||||
{'name': 'CONVERTER_IM_CONVERT_PATH',
|
||||
'value': converter_settings.IM_CONVERT_PATH, 'exists': True,
|
||||
'description': converter_settings.setting_description},
|
||||
{'name': 'CONVERTER_UNPAPER_PATH',
|
||||
'value': converter_settings.UNPAPER_PATH, 'exists': True,
|
||||
'description': converter_settings.setting_description},
|
||||
{'name': 'CONVERTER_IM_CONVERT_PATH',
|
||||
'value': converter_settings.IM_CONVERT_PATH, 'exists': True,
|
||||
'description': converter_settings.setting_description},
|
||||
{'name': 'CONVERTER_IM_IDENTIFY_PATH',
|
||||
'value': converter_settings.IM_IDENTIFY_PATH, 'exists': True,
|
||||
'description': converter_settings.setting_description},
|
||||
{'name': 'CONVERTER_GM_PATH',
|
||||
'value': converter_settings.GM_PATH, 'exists': True,
|
||||
'description': converter_settings.setting_description},
|
||||
{'name': 'CONVERTER_GM_SETTINGS', 'value': converter_settings.GM_SETTINGS},
|
||||
{'name': 'CONVERTER_GRAPHICS_BACKEND',
|
||||
'value': converter_settings.GRAPHICS_BACKEND,
|
||||
'description': converter_settings.setting_description},
|
||||
|
||||
@@ -221,6 +221,8 @@ TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
#CONVERTER_IM_IDENTIFY_PATH = u'/usr/bin/identify'
|
||||
#CONVERTER_UNPAPER_PATH = u'/usr/bin/unpaper'
|
||||
#CONVERTER_GRAPHICS_BACKEND = u'converter.backends.imagemagick'
|
||||
#CONVERTER_GM_PATH = u'/usr/bin/gm'
|
||||
#CONVERTER_GM_SETTINGS = u''
|
||||
|
||||
# OCR
|
||||
#OCR_TESSERACT_PATH = u'/usr/bin/tesseract'
|
||||
|
||||
Reference in New Issue
Block a user