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)