Loading

python 视频转 gif

1. 说明

需要 python 版本 >= 3.9


2. 使用 opencvPIL

  1. 用Python处理MP4与GIF格式互转,简单到爆!-python 视频转gif

3. 使用 moviepy

  1. 3行Python代码即可将视频转Gif-腾讯云开发者社区-腾讯云

4. 遇到的问题

4.1. module 'PIL.Image' has no attribute 'ANTIALIAS'

ANTIALIAS was removed in Pillow 10.0.0 (after being deprecated through many previous versions). Now you need to use PIL.Image.LANCZOS or PIL.Image.Resampling.LANCZOS.
(This is the exact same algorithm that ANTIALIAS referred to, you just can no longer access it through the name ANTIALIAS.)

使用 pip install Pillow==9.5.0 安装低版本即可。
参考:10.0.0 (2023-07-01) - Pillow (PIL Fork) 10.4.0 documentation


5. 相关

  1. 在 Mac 上截屏或录屏 - 官方 Apple 支持 (中国)
posted @ 2024-07-09 10:39  kingron  阅读(7)  评论(0编辑  收藏  举报