Skip to main content

TiffReader, convenience wrapper for libtiff

Why?

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

Open

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

Random Access

tif.seek(10)
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:

tif.seek(10)
result = np.zeros(tif.shape, dtype=np.uint64)
for frame in zip(tif, range(10)):
    result += frame
result /= 10

Additionally

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

Metadata

Release files for tiffreader 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tiffreader 0.1.1
File Size Uploaded Provenance Actions
tiffreader-0.1.1.tar.gz 3.7 kB Without provenance Details for tiffreader-0.1.1.tar.gz

Release files / tiffreader-0.1.1.tar.gz

Download URL tiffreader-0.1.1.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
742da4aabfeab2c4515f1abb442001f17d80bae3863ab9f2adedb7eee377ef14
BLAKE2b-256 checksum
How to use checksums
9a6c61a7c528ccb9908a16d19171f0f34088e14c873811a37ab78f3c00686241
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

Security for tiffreader 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page