目錄
- 利用python反轉圖片/視頻
- 安裝庫
- 反轉效果
- 實現(xiàn)代碼
- 項目地址
利用python反轉圖片/視頻
- 準備:一張圖片/一段視頻
- python庫:Pillow,moviepy
安裝庫
pip install Pillow -i https://mirrors.aliyun.com/pypi/simple
pip install moviepy -i https://mirrors.aliyun.com/pypi/simple
默認官方鏡像源,我這里嘗試的時候沒有任何進度。切換到國內的源,比如阿里鏡像,清華鏡像即可。第一次使用國內源,簡直是神速!
反轉效果

反轉后

實現(xiàn)代碼
圖片
from PIL import Image, ImageOps
img = Image.open('img/python.jpg')
img_mirror = ImageOps.mirror(img)
img_mirror.save('img/python_mirror.jpg')
視頻
import moviepy
from moviepy.editor import VideoFileClip,vfx
video = 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+uiautomator2實現(xiàn)自動刷抖音視頻功能
- Python爬蟲之爬取嗶哩嗶哩熱門視頻排行榜
- python基于tkinter制作m3u8視頻下載工具
- Python使用UDP實現(xiàn)720p視頻傳輸?shù)牟僮?/li>
- 寫一個Python腳本自動爬取Bilibili小視頻
- 用python制作詞云視頻詳解
- Python通過m3u8文件下載合并ts視頻的操作
- 用Python制作燈光秀短視頻的思路詳解
- Python從視頻中提取音頻的操作
- python爬取梨視頻生活板塊最熱視頻
- 教你如何使用Python下載B站視頻的詳細教程