Converting TIFF files to PDF and/or JPEG

billuseslinux at gmail.com billuseslinux at gmail.com
Wed Jan 18 01:17:42 CET 2006


The Tiff library and utilities combined with Ghostscript make this very
easy.

http://www.remotesensing.org/libtiff/

http://www.cs.wisc.edu/~ghost/

With the above two packages installed, you can do something like this
in Python:

def tiff2pdf(width, length, files):
        path, filename = os.path.split(files)
        name, ext = os.path.splitext(filename)
        output = os.path.join(path, name + ".pdf")
        command = \
        'tiff2ps -a2 -w%s -h%s "%s" | ps2pdf - "%s"' % (width, length,
files, output)
        os.popen(command)

I use a function like this all the time to convert Tiffs to PDF.

HTH

Bill




More information about the Python-list mailing list