Use pilkit's process_image utility

This commit is contained in:
Matthew Tretter 2013-05-09 21:35:09 -04:00
parent 82eb69b3be
commit 4efa05099d
2 changed files with 5 additions and 13 deletions

View file

@ -4,8 +4,7 @@ from ..cachefiles.backends import get_default_cachefile_backend
from ..cachefiles.strategies import StrategyWrapper
from .. import hashers
from ..exceptions import AlreadyRegistered, MissingSource
from ..processors import ProcessorPipeline
from ..utils import open_image, img_to_fobj, get_by_qname
from ..utils import open_image, get_by_qname, process_image
from ..registry import generator_registry, register
@ -137,16 +136,9 @@ class ImageSpec(BaseImageSpec):
self.source.open()
img = open_image(self.source)
original_format = img.format
# Run the processors
processors = self.processors
img = ProcessorPipeline(processors or []).process(img)
options = dict(self.options or {})
format = self.format or img.format or original_format or 'JPEG'
content = img_to_fobj(img, format, **options)
return content
return process_image(img, processors=self.processors,
format=self.format, autoconvert=self.autoconvert,
options=self.options)
def create_spec_class(class_attrs):

View file

@ -50,7 +50,7 @@ setup(
test_suite='testrunner.run_tests',
install_requires=[
'django-appconf>=0.5',
'pilkit',
'pilkit>=0.2.0',
],
extras_require={
'async': ['django-celery>=3.0'],