Question: Using Python and tkinter The problem I'm running in to is that i can't get the image to save to a folder of the users

Using Python and tkinter

The problem I'm running in to is that i can't get the image to save to a folder of the users choice. After getting an image the from user who browses through a folder to display in the window. So I want to now take that image and save it to a folder of my choice.

from tkinter import * from tkinter.filedialog import askopenfilename from PIL import ImageTk, Image def browseFile(): filename = askopenfilename() photo = ImageTk.PhotoImage(Image.open(filename)) image1 = Label(root, image=photo) image1.image=photo image1.place(x=250, y=150) def saveImage(browseFile): # image = browseFile  # image.save("new_"+ browseFile)  root = Tk() #window size root.geometry('1200x700') #title details title = Label(root, text="Title", bg="white", fg="black") #placing the title top center title.place(x=540, y=0) #button for the user to browse the folders for an image browseImage =Button(root,text="Browse Image", bg="white",fg="black",command=browseFile) browseImage.place(x=300,y=400) #button to save the image to a folder of the users choice saveImage = Button(root,text="Save Image", bg="white", fg="black",command=saveImage) saveImage.place(x=800,y=400) root.mainloop() 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!