代码拉取完成,页面将自动刷新
import tkinter
from tkinter import Label
from PIL import Image, ImageTk, ImageEnhance, ImageFilter
win = tkinter.Tk()
win.title('增强图像')
win.geometry('300x300') #定义窗体的大小400x200像素
photo = Image.open('dukou.jpg')
img1 = ImageTk.PhotoImage(photo) # 获取图片像素
label_1 = Label(win, image=img1)
def imgshow():
#img = ImageEnhance.Contrast(photo)
#img = img.enhance(1.8) #对比度增强为原来的1.5倍
img = photo.filter(ImageFilter.EDGE_ENHANCE)
img2 = ImageTk.PhotoImage(img) # 获取图片像素
label_2 = Label(win, image=img2).grid(row=1, column=1)
label_2.image = img2
button = tkinter.Button(win, text='增强图像处理',command=imgshow)
button.grid(row=0, column=0, columnspan=2)
label_1.grid(row=1, column=0)
win.mainloop()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。