这个程序实现的效果是能做一个6张图片的图片展,运用到了Pillow库,需要安装这个第三方库,6张图片的效果分别是原图、加粗边缘图、模糊图、浮雕图、描边图、轮廓图。

(运行之后图片会滚动)
Python源代码如下:
from PIL import Image,ImageFilter
import turtle as t
img1 = Image.open('1.png')
img2 = img1.filter(ImageFilter.EDGE_ENHANCE)
img3 = img1.filter(ImageFilter.GaussianBlur)
img4 = img1.filter(ImageFilter.EMBOSS)
img5 = img1.filter(ImageFilter.FIND_EDGES)
img6 = img1.filter(ImageFilter.CONTOUR)
width = 351
height = 248
img7 = Image.new(mode='RGB',size=(width*6,height),color='black')
img7.paste(img1,(0,0))
img7.paste(img2,(width,0))
img7.paste(img3,(width*2,0))
img7.paste(img4,(width*3,0))
img7.paste(img5,(width*4,0))
img7.paste(img6,(width*5,0))
img7.save('长图.gif')
t.register_shape('长图.gif')
t.shape('长图.gif')
t.penup()
for i in range(10000):
t.forward(-5)
t.done()
该程序用Python的Pillow库对一张图片应用了六种不同的滤镜效果,包括加粗边缘、模糊、浮雕、描边、找到边缘和轮廓,生成一个滚动展示这些效果的长图.gif,并利用turtle库创建了一个简单的动画来显示图片的滚动效果。
334

被折叠的 条评论
为什么被折叠?



