PIL>>> Image.open('f.GIF').save('f.jpg', 'JPEG') # ?
Dinu C. Gherman
gherman at darwin.in-berlin.de
Tue May 23 05:24:22 EDT 2000
Hello,
after studying the PIL tutorial I don't think I found the
proper place explaining why I get an error like this when
I try to save a GIF file in JPEG format:
>>> im = Image.open('sample.gif')
>>> im.save('sample.jpg', 'jpeg')
Traceback (innermost last):
File "<interactive input>", line 0, in ?
File "Image.py", line 665, in save
SAVE[string.upper(format)](self, fp, filename)
File "JpegImagePlugin.py", line 298, in _save
raise IOError, "cannot write mode %s as JPEG" % im.mode
IOError: cannot write mode P as JPEG
Is it because palette mode images cannot be converted to
JPEG? If so, can it be done with the pilconvert utility?
I haven't tested this, but if pilconvert can do it, why
isn't it possible without?
Regards,
Dinu
--
Dinu C. Gherman
................................................................
"The only possible values [for quality] are 'excellent' and 'in-
sanely excellent', depending on whether lives are at stake or
not. Otherwise you don't enjoy your work, you don't work well,
and the project goes down the drain."
(Kent Beck, "Extreme Programming Explained")
More information about the Python-list
mailing list