GIF图倒序播放
今天在爬蟲群,看到一個有趣的Python代碼,可以把GIF圖倒序播放,代碼很簡單,首先要安裝pillow庫。
代碼
from PIL import Image,ImageSequence with Image.open('C:/Users/LP/Desktop/timg.gif') as im:if im.is_animated: #判斷是否為動態frames = [f.copy() for f in ImageSequence.Iterator(im)] #把每幀取出來frames.reverse() #反轉frames[0].save('C:/Users/LP/Desktop/out.gif', save_all=True, append_images=frames[1:]) #形成新圖原理很簡單,就是把每幀圖片倒序即可。
原圖
倒序圖
哈哈,有點暈
總結
- 上一篇: sshd修改端口后几次启动失败
- 下一篇: 《科学+ 预见人工智能》——“工具”本质