PIL error in saving images

Fredrik Lundh fredrik at pythonware.com
Sat Mar 29 10:34:15 CET 2003

"Anand B Pillai" wrote:

>  This is a PIL(Python Imaging Library) specific problem.
> I am saving a windows bmp file as a jpeg file in my image viewer
> application which uses PIL. It used to work properly but now
> I am getting this error.

(you may get a quicker response by posting to the image-sig
mailing list)

> #Error
> Traceback (most recent call last):
>   File "<stdin>", line 3211, in doSaveImageAs
>   File "<stdin>", line 3150, in SaveImageAsFormat
>   File "d:\python22\lib\site-packages\PIL\Image.py", line 741, in save
>     SAVE[string.upper(format)](self, fp, filename)
>   File "d:\python22\lib\site-packages\PIL\JpegImagePlugin.py", line 329, in _save
>     ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)])
>   File "d:\python22\lib\site-packages\PIL\ImageFile.py", line 369, in _save
>     e = Image._getencoder(im.mode, e, a, im.encoderconfig)
>   File "d:\python22\lib\site-packages\PIL\Image.py", line 269, in _getencoder
>     return apply(encoder, (mode,) + args + extra)
> TypeError: function takes at most 7 arguments (9 given)
> The PIL key for jpeg images is "JPEG" AFAIK. I never got this
> error before. Looks like JpegImagePlugin is unable to determine the
> file format and is asking Image module which is also failing there.

looks like version mismatch; you're using new PY files with an older
_imaging.pyd (or DLL).

to check what _imaging file you're using, try this:

>>> import _imaging
>>> print _imaging.__file__


<!-- (the eff-bot guide to) the python standard library:

More information about the Python-list mailing list