我正在使用 wand 基本上对 gif 进行逐帧翻译。我想将图像转置到 gif 的每一帧中,然后保存输出的动画 gif。
def placeImage(gif_name, image_name, save_location):
with Image(filename = gif_name) as gif:
with Image(filename = image_name) as image:
new_frames = []
for frame_orig in gif_new.sequence:
frame = frame_orig.clone()
with Drawing() as draw:
draw.composite(operator='src_over', left=20, top=20,
width=image.width, height=image.height, image=image)
draw(frame)
new_frames.append(frame)
所以现在我已经得到了所有这些帧(虽然它们不是 SingleImage 对象,而是 Image 对象),我想将它们重新组合在一起并生成一个新的 gif。有什么建议吗?
我希望能够做类似的事情:
with gif.clone() as output:
output.sequence=new_frames
output.save(filename=save_location)