473,385 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Uncompressing TIFF files directly in Python

Hey guys,

OK this is a long shot but does anyone know of a way to uncompress tiff
files directly in python. I know it can be done with an os call but
that'll only work on unix and only if the right software is installed!

I need to convert tiff images downloaded from uspto.gov to pdf, these
images are compressed using G4, so I dunno if anyone knows of a method
of doing this witout the os call! Surely there is a utility out there
somewhere?

Sophie

Jan 18 '06 #1
8 3083
sophie_newbie wrote:
Hey guys,

OK this is a long shot but does anyone know of a way to uncompress tiff
files directly in python. I know it can be done with an os call but
that'll only work on unix and only if the right software is installed!

I need to convert tiff images downloaded from uspto.gov to pdf, these
images are compressed using G4, so I dunno if anyone knows of a method
of doing this witout the os call! Surely there is a utility out there
somewhere?


Why didn't you want an OS call? Do you have other constraints that
would invalidate anything but a pure Python solution?

What about using FreeImage? (http://freeimage.sourceforge.net)

It can be called via ctypes as http://freeimagepy.sourceforge.net/ does.

-Peter

Jan 18 '06 #2
"sophie_newbie" <pa**********@gmail.com> writes:
I need to convert tiff images downloaded from uspto.gov to pdf, these
images are compressed using G4, so I dunno if anyone knows of a method
of doing this witout the os call! Surely there is a utility out there
somewhere?


There's a libtiff library callable from C. Maybe someone has written
Python wrappers for it; if not, maybe you can become that someone.
Jan 18 '06 #3
I mainly just need it to work with windows and assumed that an os call
would only work with windows!

I've downloaded that free image software and the ctypes program, it
seems to be working but I haven't yet worked out how to get it to
decompress a G4 TIFF image...

If anyone knows it would be of help?

Jan 18 '06 #4
"sophie_newbie" wrote:
I mainly just need it to work with windows and assumed that an os call
would only work with windows!

I've downloaded that free image software and the ctypes program, it
seems to be working but I haven't yet worked out how to get it to
decompress a G4 TIFF image...

If anyone knows it would be of help?


tiffcp and friends are available for windows too:

http://gnuwin32.sourceforge.net/packages/tiff.htm

infile = "somefile.tif"

os.system("tiffcp -c none %s temp.tif" % infile)

im = Image.open("temp.tif")

</F>

Jan 18 '06 #5
sophie_newbie wrote:
I mainly just need it to work with windows and assumed that an os call
would only work with windows!


Presumably you mistyped something there, since what you are basically
saying is that an os call which only works on windows would suit you
just fine since you only care about windows.

-Peter

Jan 18 '06 #6
sophie_newbie wrote:
Hey guys,

OK this is a long shot but does anyone know of a way to uncompress tiff
files directly in python. I know it can be done with an os call but
that'll only work on unix and only if the right software is installed!

I need to convert tiff images downloaded from uspto.gov to pdf, these
images are compressed using G4, so I dunno if anyone knows of a method
of doing this witout the os call! Surely there is a utility out there
somewhere?


You can look into using the Python Imaging Library, which supports
reading TIFFs and runs on multiple platforms, including Windows.

http://www.pythonware.com/products/pil/

Gary Duzan
Motorola CHS
Jan 18 '06 #7
Ya I did, sorry!

Jan 18 '06 #8
Ya that was the original plan but it didn't support the G4 compression
of the tif files!

I think the idea of using tiffcp is the best as it runs on both unix
and windows which is what i need!

Jan 18 '06 #9

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

Similar topics

0
by: Piotr Legiecki | last post by:
Hi How can I read and transform (in various ways) 16 bit tiff images using python? It looks like PIL does not support such images. Those 16bit images are RAW data files directly from scanner (in...
17
by: PyPK | last post by:
Hi I am looking for a simple tiff Image reader/writer in python.Can anyone point me to the right one.
4
by: Dominic | last post by:
Hi guys, In .NET, how can I convert a HTML file to TIFF efficiently? One possible way is that I can first use word automatation to load the HTML up and then print it to TIFF. Is that right?...
3
by: Oliver | last post by:
Hello! I am really stuck... I have searched the whole internet to find a dll or a API which I can use in .NET C# to uncompress all the major archiv files but I really didnt find anything whith...
10
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...
3
by: Andres Corrada-Emmanuel | last post by:
Hello, I have installed PIL 1.1.5 on Windows with Python 2.4. I'm unable to open .tiff images that I can open and view using Windows Explorer. In other words, this simple test fails: import...
1
by: Stedak | last post by:
I have the following class I use to save Tiff's. The problem I have with it is that the final size of the images are very large. If we scan directly to a file the final tiff may be 600-900 kb.s but...
7
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....
5
by: senadslipac | last post by:
How to Q: Uncompressing ~400K files on Apache Server Hello All, I have ~400K html files on my local XP machine and I’d like to compress the files, upload them onto my host (apache - pair.com)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...

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.