How to break gif format and create small png format using python?

Asked By 0 points N/A Posted on -
qa-featured

Hi,

I need your help. I have some gif pictures. I need to break its format and create small png format pictures using python. How can I do it? Please, tell me in details.

Thanks

SHARE
Best Answer by Barbara Miller
Best Answer
Best Answer
Answered By 0 points N/A #166150

How to break gif format and create small png format using python?

qa-featured

Hello Trojan Helan, I order to create png format pictures from gif using python, you would normally use Python Image Library (PIL). Here is its link: http://www.pythonware.com/library/pil/handbook/index.htm You will find in detail help at this website, I suggest you take a look at The Imagedraw Module in Part Two and PNG file format in the appendix.

Answered By 0 points N/A #166151

How to break gif format and create small png format using python?

qa-featured

 

Hey Trojan,

Use the following code to be able to convert gif format to png using Python. There are many open source projects online that offer this method.

 

importImage,glob,os

files = glob.glob("small/*.gif")

forimageFile infiles:

    filepath,filename = os.path.split(imageFile)

    filterame,exts = os.path.splitext(filename)

    print"Processing: "+ imageFile,filterame

    im = Image.open(imageFile)

    im.save( 'small_/'+filterame+'.png','PNG')

Related Questions