[NEWBIE] How to call an external program

Discussion in 'Python' started by Philipp Neuhaus, Sep 18, 2003.

  1. 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
    Philipp Neuhaus, Sep 18, 2003
    #1
    1. Advertising

  2. Philipp Neuhaus

    Ulrich Petri Guest

    "Philipp Neuhaus" <mailto:p> schrieb im
    Newsbeitrag news:...
    > 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
    Ulrich Petri, Sep 18, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tobias Merler
    Replies:
    0
    Views:
    464
    Tobias Merler
    Sep 24, 2003
  2. Sanyi Benczik

    how to call an external program?

    Sanyi Benczik, Dec 14, 2003, in forum: C++
    Replies:
    10
    Views:
    987
    Chris Mantoulidis
    Dec 16, 2003
  3. Scott Allen
    Replies:
    8
    Views:
    10,902
    Scott Allen
    May 2, 2004
  4. guest7

    How to call external c++ program

    guest7, Jan 4, 2009, in forum: C Programming
    Replies:
    0
    Views:
    401
    guest7
    Jan 4, 2009
  5. Replies:
    8
    Views:
    123
    Tad McClellan
    Jun 19, 2006
Loading...

Share This Page