1

I've opened an issue already here (https://github.com/python-imaging/Pillow/issues/646) but I'm not having much luck with any responses from anyone. Using Pillow, I am taking a large white .gif file and drawing lots of lines and text onto it. It works perfectly fine until I do one too many draw calls. It seems to be dependent on how much is being drawn onto the image. For example, I can do more small line draws than large line draws. One too many draws and I get this error:

File "draw/card.py", line 13, in save
  self.image.save(os.path.join(os.path.dirname(os.path.abspath(__file__)), '%s.gif' % file_name), 'gif')
File ".../local/lib/python2.7/site-packages/PIL/Image.py", line 1564, in save
  save_handler(self, fp, filename)
File ".../local/lib/python2.7/site-packages/PIL/GifImagePlugin.py", line 317, in _save
  ImageFile._save(imOut, fp, [("gif", (0,0)+im.size, 0, rawmode)])
File ".../local/lib/python2.7/site-packages/PIL/ImageFile.py", line 473, in _save
  e = Image._getencoder(im.mode, e, a, im.encoderconfig)
File ".../local/lib/python2.7/site-packages/PIL/Image.py", line 413, in _getencoder
  return encoder(mode, *args + extra)
SystemError: unknown raw mode

I have removed the full file paths but the .../local/lib are in my virtualenv

Is this a known bug or am I doing something wrong or have I found something wrong with PIL?

chas11man
  • 108
  • 1
  • 6

1 Answers1

1

This is a bug in Pillow. From a comment by wiredfool:

For future reference for people coming from search engines, this is a bug. I can replicate it on my machine.

There is a simple work around -- before saving the image as a gif, convert it to mode 'P'.

Community
  • 1
  • 1
Hugo
  • 27,885
  • 8
  • 82
  • 98