| Index of /software_projects/2004/pytiff |
Name Last modified Size Description
Parent Directory 21-May-2005 20:15 -
python-style.css 21-May-2005 20:16 1k
pytiff-0.1.6.tar.gz 13-Jun-2005 01:28 2.8M
pytiff.html 07-Jul-2005 02:32 41k
PyTIFF is a library for using TIFF files and advanced imaging in Python. To install pytiff, download the current tar.gz archive and unpack in a directory of your choice. Then, provided you have the necessary software installed, you can install pytiff with python setup.py install, or type python setup.py --help for more information. The library is documented in pytiff.html. Have fun!
I very much appreciate the valuable suggestions, bugfixes, and encouraging emails I have received in response to the first release of PyTIFF. The next release, due this spring or summer, will offer the following additional features:
You can determine how an image will be compressed by setting an appropriate value for the 'compression' key in its metadata. Here is an example to convert all images of a TIFF file to G4 compression. (This will, of course, fail if the source images aren't black and white.)
import pytiff class AttrChangeFilter: def __init__(self, image, new_metadata): self.image = image self.new_metadata = new_metadata def __getattr__(self, attr): return getattr(self.image, attr) def get_metadata(self): return self.new_metadata metadata = property(get_metadata, None, None) r = pytiff.TiffReader("infile.tiff") w = pytiff.TiffWriter("outfile.tiff") for p in r: m = dict(p.metadata) m["compression"] = "T6" p = AttrChangeFilter(p, m) w.append(p)
Copyright © 2005 by Oliver M. Haynold
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Last modified: Wed Feb 23 01:38:38 CST 2005