[Image-SIG] WG: How to create instance of Image ?
Graf Patrick
pg@puggy.com" <pg@puggy.com
Fri, 11 Jun 1999 00:09:22 +0200
maybe a simple problem, if you know the solution....
Hi all,
I'm trying to write a class for my own image processing needs.
In this matter, I'm having problems with some variable declarations
I'd like to create a image variable, let's call it myPicture .
So I tried to declare
myPicture = Image.Image()
outside the class. This works fine for opening an image like
myPicture.open("MyImage.jpg")
file but I get an error when I try to save the image.
Traceback (innermost last): File
"D:\Inetpub\wwwroot\test_image\smPicUpload2.py", line 203, in ?
smPic.save(savePath) File "D:\Inetpub\wwwroot\test_image\smPicture.py",
line 45, in save myPicture.save(filename) File
"c:\python.151\PIL\Image.py", line 615, in save
SAVE[string.upper(format)](self, fp, filename) File
"c:\python.151\PIL\JpegImagePlugin.py", line 297, in _save raise IOError,
"cannot write mode %s as JPEG" % im.mode IOError: cannot write mode as JPEG
Thanks for any help !
Patrick
Note: Is it possible to use an Image object and pass it to a procedure ?