pytiff
index
/home/oliverh/software-projects/pytiff/pytiff.so

Tiff handling and advanced imaging for Python.
Copyright (c) 2004 by Oliver M. Haynold
 
A little code example:
To crop all pages of a TIFF file to 200 * 200 pixels say:
 
r=pytiff.TiffReader('source.tif')
w=pytiff.TiffWriter('dest.tiff')
for p in r:
   w.append(pytiff.CropFilter(p, (0,0), (200, 200)))
 
That's all!
 
All image objects have these attributes:
- bits_per_sample 
- samples_per_pixel
- photometric_interpretation: a string;
    for most operations arbitrary values are acceptable, but the library currently understands:
    -'grey' for grey or black/white data with 0 being black
    -'RGB' and and 'RGBA'
- sample_format
   - 'unsigned integer' (default if this attribute is missing)
   - 'signed integer'
   - 'IEEE floating point'
   - 'integer complex'
   - 'IEEE floating point complex'
   - 'void' (this really implies the data is meaningless, so avoid it!)
- size: a tuple of two integers, width first
- data: the image data
- metadata: a dictionary with the image metadata
 
Filters generate their results on the fly, and all objects in this modules, with the exception 
of TiffWriter, are immutable.

 
Classes
        
__builtin__.object
IdentityFilter
ChangeBitsPerSampleFilter
CropFilter
FlipFilter
RotateFilter
ScaleDownToRGBAFilter
MemoryImage
TiffReader
TiffReaderPage
TiffWriter
 
class ChangeBitsPerSampleFilter(IdentityFilter)
    The ChangeBitsPerSampleFilter changes the bits_per_sample of an image. Instantiate with 
pytiff.ChangeBitsPerSampleFilter(baseimage, bits_per_sample) .* Currently this only works for unsigned int. *
 
 
Method resolution order:
ChangeBitsPerSampleFilter
IdentityFilter
__builtin__.object

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new  object with type S, a subtype of T
bits_per_sample = <member 'bits_per_sample' of 'pytiff.ChangeBitsPerSampleFilter' objects>
Image bits per sample
data = <attribute 'data' of 'pytiff.ChangeBitsPerSampleFilter' objects>
Image data

Data and other attributes inherited from IdentityFilter:
metadata = <attribute 'metadata' of 'pytiff.IdentityFilter' objects>
Image metadata
photometric_interpretation = <attribute 'photometric_interpretation' of 'pytiff.IdentityFilter' objects>
Image photometric interpretation
sample_format = <attribute 'sample_format' of 'pytiff.IdentityFilter' objects>
Image sample format
samples_per_pixel = <attribute 'samples_per_pixel' of 'pytiff.IdentityFilter' objects>
Image samples per pixel
size = <attribute 'size' of 'pytiff.IdentityFilter' objects>
Image size
 
class CropFilter(IdentityFilter)
    The CropFilter crops an image. Instantiate with pytiff. CropFilter(baseimage, (pos_x, pos_y), 
(size_x, size_y)) .
 
 
Method resolution order:
CropFilter
IdentityFilter
__builtin__.object

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new  object with type S, a subtype of T
data = <attribute 'data' of 'pytiff.CropFilter' objects>
Image data
size = <attribute 'size' of 'pytiff.CropFilter' objects>
Image size

Data and other attributes inherited from IdentityFilter:
bits_per_sample = <attribute 'bits_per_sample' of 'pytiff.IdentityFilter' objects>
Image bits per sample
metadata = <attribute 'metadata' of 'pytiff.IdentityFilter' objects>
Image metadata
photometric_interpretation = <attribute 'photometric_interpretation' of 'pytiff.IdentityFilter' objects>
Image photometric interpretation
sample_format = <attribute 'sample_format' of 'pytiff.IdentityFilter' objects>
Image sample format
samples_per_pixel = <attribute 'samples_per_pixel' of 'pytiff.IdentityFilter' objects>
Image samples per pixel
 
class FlipFilter(IdentityFilter)
    The FlipFilter flips an image vertically or horizontally. Instantiate with 
pytiff.FlipFilter(baseimage, "vertical")
or pytiff.FlipFilter(baseimage, "horizontal") .
 
 
Method resolution order:
FlipFilter
IdentityFilter
__builtin__.object

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new  object with type S, a subtype of T
data = <attribute 'data' of 'pytiff.FlipFilter' objects>
Image data

Data and other attributes inherited from IdentityFilter:
bits_per_sample = <attribute 'bits_per_sample' of 'pytiff.IdentityFilter' objects>
Image bits per sample
metadata = <attribute 'metadata' of 'pytiff.IdentityFilter' objects>
Image metadata
photometric_interpretation = <attribute 'photometric_interpretation' of 'pytiff.IdentityFilter' objects>
Image photometric interpretation
sample_format = <attribute 'sample_format' of 'pytiff.IdentityFilter' objects>
Image sample format
samples_per_pixel = <attribute 'samples_per_pixel' of 'pytiff.IdentityFilter' objects>
Image samples per pixel
size = <attribute 'size' of 'pytiff.IdentityFilter' objects>
Image size
 
class IdentityFilter(__builtin__.object)
    The IdentityFilter does nothing. Instantiate with pytiff. IdentityFilter(baseimage) .
 
  Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new  object with type S, a subtype of T
bits_per_sample = <attribute 'bits_per_sample' of 'pytiff.IdentityFilter' objects>
Image bits per sample
data = <attribute 'data' of 'pytiff.IdentityFilter' objects>
Image data
metadata = <attribute 'metadata' of 'pytiff.IdentityFilter' objects>
Image metadata
photometric_interpretation = <attribute 'photometric_interpretation' of 'pytiff.IdentityFilter' objects>
Image photometric interpretation
sample_format = <attribute 'sample_format' of 'pytiff.IdentityFilter' objects>
Image sample format
samples_per_pixel = <attribute 'samples_per_pixel' of 'pytiff.IdentityFilter' objects>
Image samples per pixel
size = <attribute 'size' of 'pytiff.IdentityFilter' objects>
Image size
 
class MemoryImage(__builtin__.object)
    An image held in memory. Instantiate with pytiff. MemoryImage(image) or 
pytiff.MemoryImage(size, data, metadata, bits_per_sample, 
samples_per_pixel, photometric_interpretation) .
The following conventions apply:
- Where applicable, small values signify low intensity.- Data must be in MSB to LSB byte order and MSB to LSB bit order. Note 
  that this is _not_ the Intel byte order.
- Within a row, bits follow each other irrespective of byte alignment.
- Rows are byte-aligned.
 
  Methods defined here:
get_pixel(...)
Get the value of a pixel as a tuple.

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new  object with type S, a subtype of T
bits_per_sample = <member 'bits_per_sample' of 'pytiff.MemoryImage' objects>
Image bits per sample
data = <member 'data' of 'pytiff.MemoryImage' objects>
Image data
metadata = <member 'metadata' of 'pytiff.MemoryImage' objects>
Image metadata
photometric_interpretation = <member 'photometric_interpretation' of 'pytiff.MemoryImage' objects>
Image photometric interpretation
sample_format = <member 'sample_format' of 'pytiff.MemoryImage' objects>
Image sample format
samples_per_pixel = <member 'samples_per_pixel' of 'pytiff.MemoryImage' objects>
Image samples per pixel
size = <member 'size' of 'pytiff.MemoryImage' objects>
Image size
 
class RotateFilter(IdentityFilter)
    The RotateFilter rotates images. Instantiate with pytiff. RotateFilter(baseimage, angle) .
The angle is interpreted as degrees counterclockwise and right now must be a multiple of 90.
 
 
Method resolution order:
RotateFilter
IdentityFilter
__builtin__.object

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new  object with type S, a subtype of T
angle = <member 'angle' of 'pytiff.RotateFilter' objects>
rotation angle in degrees counterclockwise
data = <attribute 'data' of 'pytiff.RotateFilter' objects>
Image data
size = <attribute 'size' of 'pytiff.RotateFilter' objects>
Image size

Data and other attributes inherited from IdentityFilter:
bits_per_sample = <attribute 'bits_per_sample' of 'pytiff.IdentityFilter' objects>
Image bits per sample
metadata = <attribute 'metadata' of 'pytiff.IdentityFilter' objects>
Image metadata
photometric_interpretation = <attribute 'photometric_interpretation' of 'pytiff.IdentityFilter' objects>
Image photometric interpretation
sample_format = <attribute 'sample_format' of 'pytiff.IdentityFilter' objects>
Image sample format
samples_per_pixel = <attribute 'samples_per_pixel' of 'pytiff.IdentityFilter' objects>
Image samples per pixel
 
class ScaleDownToRGBAFilter(IdentityFilter)
    The ScaleDownToRGBAFilter simultaneously converts an image to RGBA mode and scales it down
by a given integral factor. This is useful to save memory for the screen presentation of bitmap
images. Instantiate with pytiff.ScaleDownToRGBAFilter(baseimage, factor) . A factor of 2 gives
an image half the size of the original.
* Currently this only works for unsigned int images. *
 
 
Method resolution order:
ScaleDownToRGBAFilter
IdentityFilter
__builtin__.object

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new  object with type S, a subtype of T
bits_per_sample = <attribute 'bits_per_sample' of 'pytiff.ScaleDownToRGBAFilter' objects>
Image bits per sample
data = <attribute 'data' of 'pytiff.ScaleDownToRGBAFilter' objects>
Image data
photometric_interpretation = <attribute 'photometric_interpretation' of 'pytiff.ScaleDownToRGBAFilter' objects>
Image photometric interpretation
samples_per_pixel = <attribute 'samples_per_pixel' of 'pytiff.ScaleDownToRGBAFilter' objects>
Image samples per pixel
scaledown_factor = <member 'scaledown_factor' of 'pytiff.ScaleDownToRGBAFilter' objects>
factor by which the image is scaled down; 2 means the result is half the original size
size = <attribute 'size' of 'pytiff.ScaleDownToRGBAFilter' objects>
Image size

Data and other attributes inherited from IdentityFilter:
metadata = <attribute 'metadata' of 'pytiff.IdentityFilter' objects>
Image metadata
sample_format = <attribute 'sample_format' of 'pytiff.IdentityFilter' objects>
Image sample format
 
class TiffReader(__builtin__.object)
    TiffReader reads TIFF files. Instantiate it with pytiff. TiffReader(filename) and then
access the data via the sequence interface (i.e. with reader[] and len(reader) ).
 
  Methods defined here:
__getitem__(...)
x.__getitem__(y) <==> x[y]
__len__(...)
x.__len__() <==> len(x)

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new  object with type S, a subtype of T
 
class TiffReaderPage(__builtin__.object)
    This is one page of a TIFF file. It is automatically instantiated by the  TiffReader
 
  Data and other attributes defined here:
bits_per_sample = <member 'bits_per_sample' of 'pytiff.TiffReaderPage' objects>
Image bits per sample
data = <attribute 'data' of 'pytiff.TiffReaderPage' objects>
Image data
metadata = <member 'metadata' of 'pytiff.TiffReaderPage' objects>
Image metadata
photometric_interpretation = <member 'photometric_interpretation' of 'pytiff.TiffReaderPage' objects>
Image photometric interpretation
sample_format = <member 'sample_format' of 'pytiff.TiffReaderPage' objects>
Image sample format
samples_per_pixel = <member 'samples_per_pixel' of 'pytiff.TiffReaderPage' objects>
Image samples per pixel
size = <member 'size' of 'pytiff.TiffReaderPage' objects>
Image size
 
class TiffWriter(__builtin__.object)
    TiffWriter writes images to a TIFF file. Instantiate with pytiff. TiffWriter(filename) and then
append pages with the append() method.
 
  Methods defined here:
__len__(...)
x.__len__() <==> len(x)
append(...)
Append an image to this file.

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new  object with type S, a subtype of T