diff --git a/apps/converter/backends/graphicsmagick.py b/apps/converter/backends/graphicsmagick.py index 8923e4cc89..128c337296 100644 --- a/apps/converter/backends/graphicsmagick.py +++ b/apps/converter/backends/graphicsmagick.py @@ -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()) diff --git a/apps/converter/conf/settings.py b/apps/converter/conf/settings.py index 0987a68df1..f4f91884e1 100644 --- a/apps/converter/conf/settings.py +++ b/apps/converter/conf/settings.py @@ -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') diff --git a/apps/main/views.py b/apps/main/views.py index d22f461bab..5b0a619754 100644 --- a/apps/main/views.py +++ b/apps/main/views.py @@ -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}, diff --git a/settings.py b/settings.py index e9a03ff581..34fc09bf4f 100644 --- a/settings.py +++ b/settings.py @@ -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'