[Image-SIG] System Error: unknown raw mode

Frederik Fix frederikfix at eml.cc
Fri Oct 8 17:49:58 CEST 2004


Hi,
I have a problem with the Image.tostring() method. When I call it on an
Image create with Image.new() and mode "RGBX" I receive a System Error:
unknown raw mode. When I call it with the "RGB" mode it works. Images
loaded with Image.load() work without a problem. See below for a
transcript.
Am I missing something?
Thanks in advance,
Frederik Fix

Python 2.3.4 (#1, Sep 22 2004, 20:43:21) 
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Image
>>> i1 = Image.open("f.jpg")
>>> s1 = i1.tostring("raw", "RGBX", 0, -1)
>>> i2 = Image.new("RGBA", (10,10))
>>> s2 = i2.tostring("raw", "RGB", 0, -1)
>>> s2 = i2.tostring("raw", "RGBX", 0, -1)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/sw/lib/python2.3/site-packages/PIL/Image.py", line 439, in
  tostring
    e = _getencoder(self.mode, encoder_name, args)
  File "/sw/lib/python2.3/site-packages/PIL/Image.py", line 323, in
  _getencoder
    return apply(encoder, (mode,) + args + extra)
SystemError: unknown raw mode
>>>


More information about the Image-SIG mailing list