1
我正在用魔杖基本上做一个gif的逐帧翻译。我想将图像转置到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对象,但图片对象),我想一起放回,并生成一个新的gif。有什么建议?
我希望能够做这样的事情:
with gif.clone() as output:
output.sequence=new_frames
output.save(filename=save_location)