您的位置:首頁技術文章
文章詳情頁

如何用python反轉圖片,視頻

瀏覽:3日期:2022-06-21 11:55:22
利用python反轉圖片/視頻 準備:一張圖片/一段視頻 python庫:Pillow,moviepy 安裝庫

pip install Pillow -i https://mirrors.aliyun.com/pypi/simplepip install moviepy -i https://mirrors.aliyun.com/pypi/simple

默認官方鏡像源,我這里嘗試的時候沒有任何進度。切換到國內的源,比如阿里鏡像,清華鏡像即可。第一次使用國內源,簡直是神速!

反轉效果

如何用python反轉圖片,視頻

反轉后

如何用python反轉圖片,視頻

實現代碼

圖片

from PIL import Image, ImageOpsimg = Image.open(’img/python.jpg’)img_mirror = ImageOps.mirror(img)img_mirror.save(’img/python_mirror.jpg’)

視頻

import moviepyfrom moviepy.editor import VideoFileClip,vfxvideo = VideoFileClip(’video/video.mp4’)reversed_video = video.fx(vfx.mirror_x)reversed_video.write_videofile(’video/vide_reverse.mp4’)項目地址

https://github.com/coder-chin/reverseImg

以上就是如何用python反轉圖片,視頻的詳細內容,更多關于python反轉圖片,視頻的資料請關注好吧啦網其它相關文章!

標簽: Python 編程
相關文章:
国产综合久久一区二区三区