最佳答案
我试图调整一些图像的大小,其中大部分是 JPG。但在一些图片中,我得到了一个错误:
Traceback (most recent call last):
File "image_operation_new.py", line 168, in modifyImage
tempImage.save(finalName);
File "/Users/kshitiz/.virtualenvs/django_project/lib/python2.7/site- packages/PIL/Image.py", line 1465, in save
save_handler(self, fp, filename)
File "/Users/kshitiz/.virtualenvs/django_project/lib/python2.7/site- packages/PIL/JpegImagePlugin.py", line 455, in _save
raise IOError("cannot write mode %s as JPEG" % im.mode)
IOError: cannot write mode P as JPEG
我不会改变图像类型,我使用枕头图书馆。我的操作系统是 Mac OS X。我如何解决这个问题?