[Image-SIG] PIL 1.0b1

Fredrik Lundh fredrik@pythonware.com
Mon, 19 Apr 1999 10:29:47 +0200


Piers Lauder wrote:
> There is an error in the definition of "new" in Image.py
> the distributed version has
> def new(mode, size, color = 0):
>     "Create a new image"
>     if color is None:
> 
> it should be:
> def new(mode, size, color = None):

this is not a bug; for details on the intended behaviour, see the
description of "new" at:
http://www.pythonware.com/library/pil/handbook/image.htm

>   File "/local/usr/lib/facemail/getface.py", line 231, in _makeface
>     im = Image.fromstring('1', (width, height), bitmap, 'raw', '1')
>   File "/usr/local/lib/python1.5/site-packages/PIL/Image.py", line 869, in fromstring
>     im.fromstring(data, decoder_name, args)
>   File "/usr/local/lib/python1.5/site-packages/PIL/Image.py", line 364, in fromstring
>     d = _getdecoder(self.mode, decoder_name, args)
>   File "/usr/local/lib/python1.5/site-packages/PIL/Image.py", line 225, in _getdecoder
>     return apply(decoder, (mode,) + args + extra)
> TypeError: illegal argument type for built-in operation

hmm.  I cannot repeat this problem.  does the following
snippet work for you:

import Image
bitmap = (chr(0xaa)+chr(0x55))*4
im = Image.fromstring("1", (8, 8), bitmap, "raw", "1")

if it doesn't, you may have a build/configuration problem (e.g.
using 0.3b3's script library with 1.0b1's _imaging module is likely
to result in problems like this)

Cheers /F
fredrik@pythonware.com
http://www.pythonware.com