johnmnemonik / django-photologue

Automatically exported from code.google.com/p/django-photologue
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Changing the Image Quality. #167

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

With some files if I set the image quality to high/very high PIL would fail 
with the following error:
TemplateSyntaxError at /mytemplate/
Caught IOError while rendering: encoder error -2 when writing image file
Request Method: GET
Request URL:    http://localhost/mypath/
Django Version: 1.3
Exception Type: TemplateSyntaxError
Exception Value:    
Caught IOError while rendering: encoder error -2 when writing image file
Exception Location: /home/myuser/websites/mywebsite/photologue/models.py in 
create_size, line 443

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

The file should have saved with no error.

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

Newest Photologue on Ubuntu 11.11 with Django 1.3.

After googling and testing on my computer I found this: 
http://rambleon.usebox.net/post/5075686463/pil-error-saving-a-jpeg-image

And if I changed the photologue/models.py file with this:

426:> ImageFile.MAXBLOCK = 1024*1024
427:> im.save(im_filename, 'JPEG',quality=int(photosize.quality), optimize=True)

The problem was fixed and now all my images get saved in their sizes properly...

Original issue reported on code.google.com by adriange...@gmail.com on 20 Nov 2011 at 12:07

Attachments: