Commit 5fa17349 authored by Julien Muchembled's avatar Julien Muchembled

Image._resize: small optimization of code building parameters for convert

parent 2bd429c8
...@@ -311,14 +311,13 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -311,14 +311,13 @@ class Image(TextConvertableMixin, File, OFSImage):
def _resize(self, quality, width, height, format, resolution, frame): def _resize(self, quality, width, height, format, resolution, frame):
"""Resize and resample photo.""" """Resize and resample photo."""
parameter_list = ['convert'] parameter_list = ['convert', '-colorspace', 'RGB',
parameter_list.extend(['-colorspace', 'RGB']) '-quality', str(quality),
'-geometry', '%sx%s' % (width, height)]
if format not in VALID_TRANSPARENT_IMAGE_FORMAT_LIST: if format not in VALID_TRANSPARENT_IMAGE_FORMAT_LIST:
parameter_list.extend(['-alpha', 'off']) parameter_list += '-alpha', 'off'
if resolution: if resolution:
parameter_list.extend(['-density', '%sx%s' % (resolution, resolution)]) parameter_list += '-density', '%sx%s' % (resolution, resolution)
parameter_list.extend(['-quality', str(quality)])
parameter_list.extend(['-geometry', '%sx%s' % (width, height)])
if frame is not None: if frame is not None:
parameter_list.append('-[%s]' % frame) parameter_list.append('-[%s]' % frame)
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment