Python Forum
[Tkinter] Saving images
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Saving images
#1
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:
 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
Reply


Messages In This Thread
Saving images - by Christina - Sep-13-2019, 12:55 PM
RE: Saving images - by Larz60+ - Sep-13-2019, 01:10 PM
RE: Saving images - by Christina - Sep-13-2019, 01:38 PM
RE: Saving images - by Larz60+ - Sep-14-2019, 03:16 AM
RE: Saving images - by Christina - Sep-14-2019, 09:40 PM
RE: Saving images - by Larz60+ - Sep-14-2019, 10:00 PM
RE: Saving images - by Larz60+ - Sep-14-2019, 10:06 PM
RE: Saving images - by Christina - Sep-15-2019, 06:26 PM
RE: Saving images - by Larz60+ - Sep-16-2019, 12:37 AM
RE: Saving images - by buran - Sep-16-2019, 07:02 AM
RE: Saving images - by Christina - Sep-16-2019, 05:59 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020