Sep-13-2019, 12:55 PM
Hello,
I'm trying to create a image viewer in tkinter. I have problem with saving the images. On canvas I created an image. For save I don't use PhotoImage class but first version (photo = Image.open(somefile)). I use the following commands to save it:
What I have to add to the code? Some other options or function to save selected type?
Thank you, Christina
I'm trying to create a image viewer in tkinter. I have problem with saving the images. On canvas I created an image. For save I don't use PhotoImage class but first version (photo = Image.open(somefile)). I use the following commands to save it:
a = photo.filename = asksaveasfilename(initialdir = "/",title = "Select file",filetypes = (('JPEG', ('*.jpg','*.jpeg','*.jpe','*.jfif')),('PNG', '*.png'),('BMP', ('*.bmp','*.jdib')),('GIF', '*.gif'))) photo.save(a)User can select what type of image he wants (jpg, png,...) but python doesn't save the type and throws out error.
Error:ValueError: unknown file extension:
I must write name of image like photo123.png to entry and then the image is saved. But users don't want to write .jpg,.png,... at the end of name of image.What I have to add to the code? Some other options or function to save selected type?
Thank you, Christina