I need to convert PNG images to JPG..can python help

Fredrik Lundh fredrik at pythonware.com
Wed Apr 18 14:20:13 EDT 2001


Chris Richard Adams wrote:

> I've been using ImageMagick on Linux to convert images from PNG to JPG,
> but now need to include that code in a python script.  My options are to
> somehow figure out how do call imagemagick's 'convert' from a python
> script or to use a library/module within python.  Anyone have an
> tips/advice?

import os
os.system("convert ...")

or, using PIL (http://www.pythonware.com/products/pil):

import Image
im = Image.open("infile.png")
im.save("outfile.jpg")

Cheers /F





More information about the Python-list mailing list