PIL error in saving images

Anand B Pillai abpillai at lycos.com
Wed Mar 26 14:28:16 CET 2003


 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.

#Psuedo Code
#format determined automatically from filename
im=Image.open(filename, format)
im.save(jpegfilename, "JPEG")

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.


Anand Pillai

More information about the Python-list mailing list