min*_*ins 6 animated-gif playback blender
有没有办法逐步观看动画 GIF 演示?使用Blender 截屏视频生成的动画图像示例,速度太快了:

来源:创建曲面的最快方法是什么?在 Blender.SE 上。
我自己的搜索没有成功: - Blender.SE 上的现有答案建议在 GIMP 中查看动画图像。就像OP一样,我认为这不是一个方便的方法!- 有一个适用于 Chrome 的插件(GIF Scrubber),但我没有找到适用于 Firefox 的插件。- 有一个在线服务可以获取 GIF 并添加适当的控件:此相同的 GIF 已转换。
问题: 有没有:
最后,我编写了一些 Python 代码来在 Jupyter 笔记本中显示 Gif。
我使用这些库:
IpyWidgets对于IPython.display.HTML用户界面Matplotlib.Pyplot将帧显示为图像Matplotlib.animation动画化os读取文件NumPy读取数组中的帧PIL处理图像像素该代码可以轻松地适应在没有 Jupyter 的情况下工作,但笔记本是一个很好的交互工具:
import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation, rc
from PIL import Image
import ipywidgets as widgets
from IPython.display import HTML
reader = GifReader('Muybridge_cavall_animat.gif')
fig,ax = plt.subplots()
ax.axis('off')
data = reader.seek(0)
h = ax.imshow(data)
plt.close()
def make_frame(n):
data = reader.seek(n)
h.set_data(data)
return [h]
anim = animation.FuncAnimation(fig, make_frame,
frames=reader.get_length()-1,
blit=True)
HTML(anim.to_jshtml())
Run Code Online (Sandbox Code Playgroud)
读者类:
class GifReader:
pil_image = None
length = -1
def __init__(self, file_path):
self._open(file_path)
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, traceback):
self.close()
def _open(self, file_path):
if self.pil_image != None:
raise ValueError(f'File is already open')
if os.path.isfile(file_path) == False:
raise ValueError(f'File {file_path} doesn\'t exist')
with open(file_path, 'rb') as f:
if f.read(6) not in (b'GIF87a', b'GIF89a'):
raise ValueError('Not a valid GIF file')
self.pil_image = Image.open(file_path)
self.length = self.pil_image.n_frames
def close(self):
if self.pil_image == None: return
self.pil_image.close()
self.pil_image = None
def get_length(self):
if self.pil_image == None:
raise ValueError('File is closed')
return self.length
def seek(self, n):
if self.pil_image == None:
raise ValueError('File is closed')
if n >= self.length:
raise ValueError(f'Seeking frame {n} while maximum is {self.length-1}')
self.pil_image.seek(n)
a = self.pil_image.convert ('RGB')
return a
Run Code Online (Sandbox Code Playgroud)
这个怎么样?
ffmpeg -f gif -i infile.gif outfile.mp4
你可能想稍微调整一下。来源: unix.stackexchange.com:如何在命令行上将动画 gif 转换为 mp4 或 mv4?