Initial commit of the converter image transformation refactor
This commit is contained in:
@@ -9,7 +9,10 @@ from converter.api import QUALITY_DEFAULT, QUALITY_SETTINGS
|
||||
from converter.exceptions import ConvertError, UnknownFormat, \
|
||||
IdentifyError
|
||||
from converter.backends import ConverterBase
|
||||
|
||||
from converter.literals import TRANSFORMATION_RESIZE, \
|
||||
TRANSFORMATION_ROTATE, TRANSFORMATION_DENSITY, \
|
||||
TRANSFORMATION_ZOOM
|
||||
|
||||
CONVERTER_ERROR_STRING_NO_DECODER = u'no decode delegate for this image format'
|
||||
|
||||
|
||||
@@ -29,6 +32,8 @@ class ConverterClass(ConverterBase):
|
||||
|
||||
|
||||
def convert_file(self, input_filepath, output_filepath, quality=QUALITY_DEFAULT, arguments=None):
|
||||
#if format == u'jpg':
|
||||
# extra_options += u' -quality 85'
|
||||
command = []
|
||||
command.append(unicode(IM_CONVERT_PATH))
|
||||
command.extend(unicode(QUALITY_SETTINGS[quality]).split())
|
||||
@@ -73,10 +78,15 @@ class ConverterClass(ConverterBase):
|
||||
|
||||
|
||||
def get_available_transformations(self):
|
||||
return {
|
||||
'rotate': {
|
||||
'label': _(u'Rotate [degrees]'),
|
||||
'arguments': [{'name': 'degrees'}],
|
||||
'command_line': u'-rotate %(degrees)d'
|
||||
}
|
||||
}
|
||||
return [
|
||||
TRANSFORMATION_RESIZE, TRANSFORMATION_ROTATE, \
|
||||
TRANSFORMATION_DENSITY, TRANSFORMATION_ZOOM
|
||||
]
|
||||
|
||||
|
||||
def get_page_count(self, input_filepath):
|
||||
try:
|
||||
return len(self.identify_file(unicode(input_filepath)).splitlines())
|
||||
except:
|
||||
#TODO: send to other page number identifying program
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user