I want to save the output of the following Tkinter application as an Image (png or jpg).
Here is the application snippet,
#Import the required libraries
from tkinter import *
#Create an instance of Tkinter Frame
root= Tk()
root.geometry("700x350")
canvas= Canvas(root, width= 500, height= 350)
canvas.pack()
canvas.create_rectangle(100,100,300,300, outline= 'red')
root.mainloop()
The Output of the following Code is which I want to save as png or jpg.