答复: gif convert png wrong

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

答复: gif convert png wrong


Also I found that GIMP does not work, but Adobe Image Ready work.


发件人: 宋立新(凡卓通讯) [mailto:[hidden email]]
发送时间: 20111220日 星期二 10:51
收件人: '[hidden email]'
主题: gif convert png wrong


Hello All:

       I am writing a python tool that covert gif to png so it can be used for android ROM customization.

            My script is after the text, but it doesn’t work for some gifs, such as the one at:




                   several frames are wrong(See png_ok and png_wrong)


                   And it’s not rare: 2 of my 7 gifs got wrong with the scripts.

                   While a tool named: “Ulead GIF Animator 5” under windows can convert it without problem.


                   To be honest, imagemagick and another linux tool gif2png also has the same problem. And Also AcdSee (Under Windows)!

                   I have no idea about this and I really wish to write a tool to improve our efficiency.

                   Could some expert take a look on it?


Lixin Song


#!/usr/bin/env python

# -*- coding: utf-8 -*-


import Image


im = Image.open('gif2.gif')


def iter_frames(im):


        i= 0

        while 1:


            imframe = im.copy()

            if i == 0:

                palette = imframe.getpalette()



            yield imframe

            i += 1

    except EOFError:



for i, frame in enumerate(iter_frames(im)):

    frame.save('test%d.png' % i,**frame.info)


Image-SIG maillist  -  [hidden email]