1. Bernardo Cabezas Serra
  2. cmsplugin-nivoslider
Issue #3 resolved

ImageChops

Enver Bisevac
created an issue

When I use cmsplugin_nivoslider.thumbnail_processors.pad_image on virtualenv with pillow error is ImageChops not found, I think you should change import statements. Another thing is when I use django filer with activated pad_image all images on web site are scaled to origin proportion. If I want to use wide upscale and crop is not possible.

Comments (7)

  1. Bertrand Bordage

    If you want an upscale and crop, don't add our pad_image thumbnail processor ;) For the ImageChops ImportError, I can't reproduce your bug. What versions of Python/Django/Pillow are you using?

  2. Chris Franklin

    Hey,

    I am also having this issue:

    version Pillow 2.1.0 platform linux2 2.7.4 (default, Apr 6 2013, 19:20:36) [GCC 4.8.0]

    Python 2.7.4 (default, Apr 6 2013, 19:20:36) [GCC 4.8.0] on linux2

    Django 1.5.1

    [03/Jul/2013 19:44:42] "GET /admin/filer/folder/last/?select_folder=1&t=id&pop=1 HTTP/1.1" 302 0
    Traceback (most recent call last):
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 255, in __call__
        response = self.get_response(request)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 178, in get_response
        response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response
        response = callback(request, *callback_args, **callback_kwargs)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/utils/decorators.py", line 91, in _wrapped_view
        response = view_func(request, *args, **kwargs)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/views/decorators/cache.py", line 89, in _wrapped_view_func
        response = view_func(request, *args, **kwargs)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 202, in inner
        return view(request, *args, **kwargs)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/filer/admin/folderadmin.py", line 412, in directory_listing
        }, context_instance=RequestContext(request))
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/shortcuts/__init__.py", line 29, in render_to_response
        return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/loader.py", line 170, in render_to_string
        t = get_template(template_name)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/loader.py", line 146, in get_template
        template, origin = find_template(template_name)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/loader.py", line 135, in find_template
        source, display_name = loader(name, dirs)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/loader.py", line 43, in __call__
        return self.load_template(template_name, template_dirs)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/loader.py", line 49, in load_template
        template = get_template_from_string(source, origin, template_name)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/loader.py", line 157, in get_template_from_string
        return Template(source, origin, name)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/base.py", line 125, in __init__
        self.nodelist = compile_string(template_string, origin)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/base.py", line 153, in compile_string
        return parser.parse()
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/base.py", line 274, in parse
        compiled_result = compile_func(self, token)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/loader_tags.py", line 215, in do_extends
        nodelist = parser.parse()
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/base.py", line 274, in parse
        compiled_result = compile_func(self, token)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/loader_tags.py", line 190, in do_block
        nodelist = parser.parse(('endblock',))
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/base.py", line 274, in parse
        compiled_result = compile_func(self, token)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/loader_tags.py", line 263, in do_include
        isolated_context=isolated_context)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/loader_tags.py", line 146, in __init__
        t = get_template(template_path)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/loader.py", line 146, in get_template
        template, origin = find_template(template_name)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/loader.py", line 135, in find_template
        source, display_name = loader(name, dirs)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/loader.py", line 43, in __call__
        return self.load_template(template_name, template_dirs)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/loader.py", line 49, in load_template
        template = get_template_from_string(source, origin, template_name)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/loader.py", line 157, in get_template_from_string
        return Template(source, origin, name)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/base.py", line 125, in __init__
        self.nodelist = compile_string(template_string, origin)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/base.py", line 153, in compile_string
        return parser.parse()
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/base.py", line 274, in parse
        compiled_result = compile_func(self, token)
      File "/home/chris/Farm/PSCo/env/lib/python2.7/site-packages/django/template/defaulttags.py", line 1044, in load
        (taglib, e))
    TemplateSyntaxError: 'thumbnail' is not a valid tag library: ImportError raised loading easy_thumbnails.templatetags.thumbnail: No module named ImageChops
    

    Can I give you any more info?

  3. Bernardo Cabezas Serra repo owner

    I also can't reproduce the error.

    ImageChops come from PIL/PIllow. I suggest reinstalling Pillow, and take care "Pil setup summary" has no errors. Also testing with Pillow 1.1.7, and/or PIL 1.1.7. Also check easy-thumbnails is at last version.

    Try this from ipython (or python) console:

    from PIL import ImageChops
    

    Gives you an ImportError?

  4. Chris Franklin

    Python 2.7.4 (default, Apr 6 2013, 19:20:36) Type "copyright", "credits" or "license" for more information.

    IPython 0.13.2 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details.

    In [1]: from PIL import ImageChops

    In [2]:

    No import error, I can get rid of this error by removing your extra thumbnail processor from settings.

    This works:

    THUMBNAIL_PROCESSORS = ( 'easy_thumbnails.processors.colorspace', #'cmsplugin_nivoslider.thumbnail_processors.pad_image', 'easy_thumbnails.processors.autocrop', #'easy_thumbnails.processors.scale_and_crop', 'filer.thumbnail_processors.scale_and_crop_with_subject_location', 'easy_thumbnails.processors.filters', )

    This doesn't

    THUMBNAIL_PROCESSORS = ( 'easy_thumbnails.processors.colorspace', 'cmsplugin_nivoslider.thumbnail_processors.pad_image', 'easy_thumbnails.processors.autocrop', #'easy_thumbnails.processors.scale_and_crop', 'filer.thumbnail_processors.scale_and_crop_with_subject_location', 'easy_thumbnails.processors.filters', )

    I'm wondering if it could be to do with the subject aware scale and crop?

  5. Bertrand Bordage

    OK, I managed to reproduce the bug. It's because Pillow dropped "classical" PIL imports in favor of from PIL import …. I just pushed a fix and will upload a new version to PyPI.

  6. Log in to comment