473,624 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting TIFF files to PDF and/or JPEG

Hey guys,

As part of a college project I'm trying to write a script to convert
TIFF images downloaded from the US patent office site, www.uspto.gov.

The tiff images are encoded using CCITT Group 4 compression and appear
to throw an error when i try to save them using the Image library:
im.save(outfile , "PDF)

It looks like this odd compression format is not supported, or am i
wrong?

I know its a long shot but would anyone have a different solution?

Sophie.

Jan 17 '06 #1
4 8033
"sophie_new bie" <pa**********@g mail.com> wrote:
As part of a college project I'm trying to write a script to convert
TIFF images downloaded from the US patent office site, www.uspto.gov.

The tiff images are encoded using CCITT Group 4 compression and appear
to throw an error when i try to save them using the Image library:
im.save(outfile , "PDF)


It looks like this odd compression format is not supported, or am i
wrong?

I know its a long shot but would anyone have a different solution?


http://mail.python.org/pipermail/pyt...ry/258893.html

</F>

Jan 17 '06 #2
"sophie_new bie" <pa**********@g mail.com> writes:
It looks like this odd compression format is not supported, or am i
wrong?

I know its a long shot but would anyone have a different solution?


I don't know about doing it directly in Python but there's a Linux
command line utility called tiff2ps (and now tiff2pdf) that I've done
that with.

At one point I was doing a lot of these conversions and I remember
writing a Python script around the command line utility to take care
of finding the files to convert, generating the right filenames, and
so forth. It was no big deal.
Jan 17 '06 #3
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(f iles)
name, ext = os.path.splitex t(filename)
output = os.path.join(pa th, name + ".pdf")
command = \
'tiff2ps -a2 -w%s -h%s "%s" | ps2pdf - "%s"' % (width, length,
files, output)
os.popen(comman d)

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

HTH

Bill

Jan 18 '06 #4
Hmm, does anyone know if there is a way to uncompress Tiff files in
python itself without having to make an os call.

This is because the script is kind of supposed to run on windows
also...

Sophie.

Jan 18 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2704
by: usao | last post by:
Does anyone know where I can find C subroutines to read JPEG and/or TIFF files into 2-dimensional C arrays?
10
11044
by: rtilley | last post by:
Hope it's not inappropriate to post this here. Could someone critique my code? I have no Python programmers in my office to show this to. The script works OK, but should I do it differently? I especially don't like how I check to see if jpegs exist. The style may not be acceptable to some, but I'm concerned with substance, not style. Is there a 'more appropriate' way to do this? Thanks to all who take the time to give advice!
7
3780
by: Ben | last post by:
Hi We are looking for a component that offers that offers the below for Tiff files: Image clean-up (deskew, despeckle) Printing capabilities from VB The ability to add text to image, e.g. time / date Nice to have:
2
4968
by: mndprasad | last post by:
hi all i am doing a project in java where i need to convert 10 jpeg images into a single tiff image..conversion of single jpeg image to single tiff is happening but embedding all the 10 jpeg images into a single tiff is not happening..i hav tried out with single image conversion.. My code is *********************** import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO;
0
8174
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8624
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7164
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1786
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1485
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.