Ai
1 Star 0 Fork 0

我在吃大西瓜呢/Python课程学习

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ex5_7.py 799 Bytes
一键复制 编辑 原始数据 按行查看 历史
我在吃大西瓜呢 提交于 2020-04-01 16:05 +08:00 . second commit
import tkinter
from tkinter import Label
from PIL import Image, ImageTk, ImageEnhance, ImageFilter
win = tkinter.Tk()
win.title('增强图像')
win.geometry('400x200') #定义窗体的大小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()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/wang_ming_er/python_course_learning.git
git@gitee.com:wang_ming_er/python_course_learning.git
wang_ming_er
python_course_learning
Python课程学习
master

搜索帮助