[NEWBIE] How to call an external program

P

Philipp Neuhaus

Hi,
I want to convert an image file, so I have to call an external
program.
How can I do this?

(i want to call "sfftobmp -tifs input tempfile" and "tiff2ps tempfile*
| ps2pdf [output]")

Philipp
 
U

Ulrich Petri

Philipp Neuhaus said:
Hi,
I want to convert an image file, so I have to call an external
program.
How can I do this?

(i want to call "sfftobmp -tifs input tempfile" and "tiff2ps tempfile*
| ps2pdf [output]")

-----code---cut here----
import os

def convertImage(infile, outfile):
os.system('sfftobmp -tifs %s tempfile' % infile)
os.system('tiff2ps tempfile* | ps2pdf %s' % outfile)

convertImage('/home/user/in.tif', '/home/user/out.pdf')
-----code---cut here----

HTH

Ciao Ulrich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top