Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- from PIL import Image, ImageTk, ImageFilter
- from tkinter import messagebox
- def blur():
- top = Toplevel()
- top.geometry('800x700')
- top.title('Blur')
- img = Image.open('book.jpg')
- out = img.filter(ImageFilter.BLUR)
- result = ImageTk.PhotoImage(out)
- ll = Label(top, image=result)
- ll.image = result
- ll.pack()
- button_close = Button(top, text='Close Window', command=top.destroy)
- button_close.pack()
- def smooth():
- top = Toplevel()
- top.geometry('800x700')
- top.title('Blur')
- img = Image.open('book.jpg')
- out = img.filter(ImageFilter.SMOOTH)
- result = ImageTk.PhotoImage(out)
- ll = Label(top, image=result)
- ll.image = result
- ll.pack()
- button_close = Button(top, text='Close Window', command=top.destroy)
- button_close.pack()
- def emboss():
- top = Toplevel()
- top.geometry('800x700')
- top.title('Blur')
- img = Image.open('book.jpg')
- out = img.filter(ImageFilter.EMBOSS)
- result = ImageTk.PhotoImage(out)
- ll = Label(top, image=result)
- ll.image = result
- ll.pack()
- button_close = Button(top, text='Close Window', command=top.destroy)
- button_close.pack()
- root = Tk()
- root.geometry('800x650')
- book = Image.open('book.jpg')
- out = book.filter(ImageFilter.DETAIL)
- test = ImageTk.PhotoImage(out)
- label = Label(image=test)
- label.image = test
- label.place(x=0, y=0)
- button = Button(root, text='Change to BLUR', command=blur)
- button.pack()
- button = Button(root, text='Change to Smooth', command=smooth)
- button.pack()
- button = Button(root, text='Change to Emboss', command=emboss)
- button.pack()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement