I need to convert PNG images to JPG..can python help
Chris Richard Adams
chrisa at ASPATECH.COM.BR
Wed Apr 18 17:48:06 EDT 2001
Thanks the os.system call seems the simplest. If a have list variables
in my python code (for example, the file name I want to convert) how can
I pass that variable to the os.system call. For example... something
like this
os.system(" convert FILE1 FILE2 ") - yet FILE1 and FILE2 are string
variables in my script.
Thanks,
Chris
-----Original Message-----
From: Fredrik Lundh [mailto:fredrik at pythonware.com]
Sent: Wednesday, April 18, 2001 3:20 PM
To: python-list at python.org
Subject: Re: I need to convert PNG images to JPG..can python help
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
--
http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list