好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

如何用python反转图片,视频

利用python反转图片/视频

准备:一张图片/HdhCmsTestcppcns测试数据一段视频 python库:Pillow,moviepy

安装库

pip install Pillow -i https://m http://HdhCmsTestcppcns测试数据 irrors.aliyun测试数据/pypi/simple
pip install moviepy -i https://mirrors.aliyun测试数据/pypi/simple

默认官方镜像源,我这里尝试的时候没有任何进度。切换到国内的源,比如阿里镜像,清华镜像即可。第一次使用国内源,简直是神速!

反转效果

反转后

实现代码

图片

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')
reverseDCdvHSyTPId_video = video.fx(vfx.mirror_x)
reversed_video.write_videofile('video/vide_reverse.mp4')

项目地址

https://github测试数据/coder-chin/reverseImg

以上就是如何用python反转图片,视频DCdvHSyTPI的详细内容,更多关于python反转图片, 编程客栈 视频的资料请关注我们其它相关文章!

查看更多关于如何用python反转图片,视频的详细内容...

  阅读:39次