赞
踩
I'm want to resize animated GIF with save animate. I'm try use PIL and PythonMagickWand (ImageMagick) and with some GIF's get bad frame. When I'm use PIL, it mar frame in read frame. For test, I'm use this code:
from PIL import Image
im = Image.open('d:/box_opens_closes.gif')
im.seek(im.tell()+1)
im.seek(im.tell()+1)
im.seek(im.tell()+1)
im.show()
When I'm use MagickWand with this code:
wand = NewMagickWand()
MagickReadImage(wand, 'd:/Box_opens_closes.gif')
MagickSetLastIterator(wand)
length = MagickGetIteratorIndex(wand)
MagickSetFirstIterator(wand)
for i in range(0, length+1):
MagickSetIteratorIndex(wand,i)
MagickScaleImage(wand, 87, 58)
MagickWriteImages(wand, 'path', 1)
My GIF where I'm get bad frame this: test gif
In GIF editor software, all frames are ok. Where is the problem? Thanks.
解决方案
I'm complete this. Must use:
wand2 = MagickCoalesceImages(wand)
MagickWriteImages(wand2, 'save_path', 1)
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。