Skip to main content

convenience wrapper for libtiff

Project description


Compared to PIL and some other tiff related projects, this package is more for scientific imaging.

Features exposed from libtiff:

  1. responds to
    1. pixel bit depth
    2. number of channels
    3. compression scheme
  2. sequential and random access to frames in multi-frame tiff
  3. query length of multi-frame tiff


from tiffreader import TiffReader
tif ="file_path.tif")

Random Access
frame = tif.read_current()  # gives a 2D numpy array

is equivalent to

frame = tif[10]

Sequential Access

example for an average image of the 10th to 20th frames:
result = np.zeros(tif.shape, dtype=np.uint64)
for frame in zip(tif, range(10)):
    result += frame
result /= 10


from tiffreader import save_tiff
array = np.array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=np.uint8)
save_tiff(array, "tif_path.tif")
tif.length  # length of multi-frame tiff stack
tif.shape   # shape of one frame
tiffinfo("tif_path.tif", ["width", "height"])  # wraps tiffinfo to query for additional tags

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tiffreader, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size tiffreader-0.1.1.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page