views:

155

answers:

2

Hello!

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.

A: 

I'm complete this. Must use:


wand2 = MagickCoalesceImages(wand)
MagickWriteImages(wand2, 'save_path', 1)
gigimon
A: 

Hello,

Could you post the complete example for the resize, and tell the library magickwand you used, or better specify download URL ?

I have downloaded but not http://pypi.python.org/pypi/magickwand/0.2 function returns me the error:

Import magickwand.image Traceback (most recent call last): File "", line 1, in File "magickwand / image.py", line 5, Import color File "magickwand / color.py", line 34, RED = Color ('red') File "magickwand / color.py", line 16, in init self._wand api.NewPixelWand = () File "magickwand / api / init.py", line 30, in getattr raise KeyError ('% s is not a valid symbol in% s'% (name, self.lib)) KeyError: "NewPixelWand is not a valid symbol in "

thanks,

Cristofaro

Cristofaro
I'm use this old bindings http://depositfiles.com/files/v2edmp1ad In file You must change path to library.All code what I'm use in this topic :)
gigimon