Can I save a tkinter PhotoImage as .gif (or any other image extension) using only Python and tkinter?
photo is the variable holding your image, you should be able to just say:
I couldn't find a list of what formats are supported, but I think the list is really limited (I can confirm that
gif worked for me though).
Looks like the method
write can be used to save a PhotoImage to a file.
>>> help(Tkinter.PhotoImage.write) Help on method write in module Tkinter: write(self, filename, format=None, from_coords=None) unbound Tkinter.PhotoImage method Write image to file FILENAME in FORMAT starting from position FROM_COORDS.
Sample usage would be something like: