richardbarran / django-photologue

A customizable plug-in photo gallery management application for the Django web framework.
BSD 3-Clause "New" or "Revised" License
674 stars 239 forks source link

Cannot write mode RGBA as JPEG #182

Closed denning closed 6 years ago

denning commented 6 years ago

Related to https://github.com/python-pillow/Pillow/issues/2609 ?

What happened:

System Info:

Error Message:

Internal Server Error: /admin/photologue/watermark/add/
OSError at /admin/photologue/watermark/add/
cannot write mode RGBA as JPEG
...
File "/home/dylan/.virtualenvs/project/lib/python3.5/site-packages/PIL/JpegImagePlugin.py" in _save
605.         rawmode = RAWMODE[im.mode]
richardbarran commented 6 years ago

I've just pushed a commit to the master branch with a possible fix - could you try it out please and let me know if it works?

denning commented 6 years ago

Wow thanks for quick response!! 👍 👍

Steps taken

Traceback (truncated)

File "/home/dylan/.virtualenvs/project/lib/python3.5/site-packages/PIL/JpegImagePlugin.py" in _save
  605.         rawmode = RAWMODE[im.mode]

...

File "/home/dylan/.virtualenvs/project/lib/python3.5/site-packages/django/contrib/admin/options.py" in save_model
  1026.         obj.save()

File "/home/dylan/.virtualenvs/project/lib/python3.5/site-packages/photologue/models.py" in save
  839.         self.clear_cache()

File "/home/dylan/.virtualenvs/project/lib/python3.5/site-packages/photologue/models.py" in clear_cache
  827.                     obj.create_size(self)

File "/home/dylan/.virtualenvs/project/lib/python3.5/site-packages/photologue/models.py" in create_size
  439.             raise e

File "/home/dylan/.virtualenvs/project/lib/python3.5/site-packages/photologue/models.py" in create_size
  433.                         optimize=True)

File "/home/dylan/.virtualenvs/project/lib/python3.5/site-packages/PIL/Image.py" in save
  1930.             save_handler(self, fp, filename)

File "/home/dylan/.virtualenvs/project/lib/python3.5/site-packages/PIL/JpegImagePlugin.py" in _save
  607.         raise IOError("cannot write mode %s as JPEG" % im.mode)
richardbarran commented 6 years ago

Hi - sorry for taking a long time to get back to you. I've pushed another commit to the master branch which fixes the second issue that you reported - well, it fixes it for me! Can you try it out please?

denning commented 6 years ago

[Edited after uninstalling and reinstalling patch to server.]

Thank you!!!! Tested on local and remote servers - worked perfectly.

So sorry for the long delay! Once again, thank you so much for your work! :+1:

richardbarran commented 6 years ago

Great to hear that this issue has been fixed!