shaoyh/django-simple-captcha

Caught ValueError while rendering: unknown resampling filter

Opened this issue · 7 comments

What steps will reproduce the problem?
1. Include a captcha field in a form

What is the expected output? What do you see instead?

TemplateSyntaxError at /captcha_view/
Caught ValueError while rendering: unknown resampling filter
Request Method: GET
Request URL:    http://django:8080/captcha_view/
Django Version: 1.3 rc 1
Exception Type: TemplateSyntaxError
Exception Value:    
Caught ValueError while rendering: unknown resampling filter
Exception Location: /usr/lib/python2.6/dist-packages/PIL/Image.py in 
__transformer, line 1656
Python Executable:  /usr/bin/python
Python Version: 2.6.6
Python Path:    
['/home/django/application1',
 '/usr/lib/python2.6',
 '/usr/lib/python2.6/plat-linux2',
 '/usr/lib/python2.6/lib-tk',
 '/usr/lib/python2.6/lib-old',
 '/usr/lib/python2.6/lib-dynload',
 '/usr/local/lib/python2.6/dist-packages',
 '/usr/lib/python2.6/dist-packages',
 '/usr/lib/python2.6/dist-packages/PIL',
 '/usr/lib/pymodules/python2.6']
Server time:    Fri, 25 Jan 2002 14:35:03 -0600

What version of the product are you using? On what operating system?

Debian 6 and django-simple-captcha-0.2.0

Please provide any additional information below.

Original issue reported on code.google.com by john.qua...@gmail.com on 18 Mar 2011 at 9:20

Attachments:

Hello, did specify any CAPTCHA related settings in your config? 

Also, which version of PIL is installed?

from PIL import Image
Image.VERSION


Finally, could you please also try and run 'manage.py test captcha' and report 
back the results?

Original comment by mbonetti on 18 Mar 2011 at 9:38

[deleted comment]
I have PIL 1.1.7
The bug is with the function rotate in image.py but i can not fix it.

The concerned line: charimage = charimage.rotate(random.randrange( 
*settings.CAPTCHA_LETTER_ROTATION ), resample=Image.BICUBIC)

Original comment by john.qua...@gmail.com on 18 Mar 2011 at 10:03

Would you mind testing this against the svn version of simple-captcha?

Original comment by mbonetti on 18 Mar 2011 at 12:30

Seconded , so still no fix ? Does anyone one knows what's the problem ? 

Original comment by phone...@gmail.com on 12 Jan 2012 at 2:19

You can remove the Antialiasing in the file "image.py" like this:

charimg = charimg.rotate(random.randrange(*(-30, 31)), expand=1) # , 
resample=Image.ANTIALIAS)

Original comment by steph...@actinetwork.com on 17 Sep 2012 at 2:25

Sorry for duplicate posting, you can resolve with this line:

charimg = charimg.rotate(random.randrange(*(-30, 31)), expand=1, 
resample=Image.BICUBIC)

Have fun!

Original comment by steph...@actinetwork.com on 17 Sep 2012 at 2:34