{"id":1033,"library":"tifffile","title":"Tifffile: Read and Write TIFF Files","description":"Tifffile is a Python library designed for reading and writing TIFF files, particularly those prevalent in scientific imaging. It offers extensive support for various TIFF formats, including BigTIFF, OME-TIFF, and multi-page TIFF stacks. Actively maintained, it receives frequent updates, with the current version being 2026.3.3, reflecting continuous development and improvements.","status":"active","version":"2026.3.3","language":"python","source_language":"en","source_url":"https://github.com/cgohlke/tifffile","tags":["tiff","image processing","scientific imaging","bioimaging","ome-tiff","bigtiff","microscopy"],"install":[{"cmd":"pip install tifffile","lang":"bash","label":"Minimal installation"},{"cmd":"pip install -U tifffile[all]","lang":"bash","label":"Full installation with all optional dependencies"},{"cmd":"conda install tifffile -c conda-forge","lang":"bash","label":"Conda installation"}],"dependencies":[{"reason":"Fundamental for array operations and image data handling.","package":"numpy"},{"reason":"Provides support for various compression and prediction schemes like LZW, JPEG, Zstd, and more.","package":"imagecodecs","optional":true},{"reason":"Optional for plotting functionality.","package":"matplotlib","optional":true}],"imports":[{"wrong":"import tifffile; image_data = tifffile.imread('image.tif')","symbol":"imread","correct":"from tifffile import imread"}],"quickstart":{"code":"import numpy as np\nimport tifffile\nimport os\n\n# Create some dummy image data\ndummy_image = np.random.rand(100, 100).astype(np.float32)\n\n# Define a filename\nfilename = 'example.tif'\n\n# Write the image data to a TIFF file\ntifffile.imwrite(filename, dummy_image, description='Generated by tifffile quickstart')\nprint(f\"Successfully wrote '{filename}'\")\n\n# Read the image data back from the TIFF file\nread_image = tifffile.imread(filename)\nprint(f\"Successfully read '{filename}' with shape: {read_image.shape}\")\n\n# Verify data\nassert np.array_equal(dummy_image, read_image)\nprint(\"Original and read image data are identical.\")\n\n# Access metadata using TiffFile context manager\nwith tifffile.TiffFile(filename) as tif:\n    if tif.pages:\n        first_page_description = tif.pages[0].tags.get('ImageDescription')\n        if first_page_description:\n            print(f\"ImageDescription from file: {first_page_description.value}\")\n        else:\n            print(\"No ImageDescription found for the first page.\")\n    else:\n        print(\"No pages found in the TIFF file.\")\n\n# Clean up the created file\nos.remove(filename)\nprint(f\"Cleaned up '{filename}'.\")","lang":"python","description":"This quickstart demonstrates how to write a NumPy array to a TIFF file, read it back, verify its content, and access basic metadata using `tifffile.imwrite`, `tifffile.imread`, and the `tifffile.TiffFile` context manager. It also includes cleanup of the created file."},"warnings":[{"fix":"Migrate code to use current API for page and file sequence access. Consult the `tifffile` GitHub repository for specific replacements in the releases or changes log [6].","message":"The `TiffPages.pages` and `FileSequence.files` attributes, as well as `stripnull`, `stripascii`, and `bytestr` functions, have been removed. Command-line interfaces were rewritten.","severity":"breaking","affected_versions":">=2026.0.0"},{"fix":"Update `TiffWriter` calls to use `TiffWriter.write` and the `compression` keyword argument. For example, `tif.save(data, compress=6)` becomes `tif.write(data, compression=6)`.","message":"The `TiffWriter.save` method is deprecated; use `TiffWriter.write` instead. Various other `TiffWriter` parameters like `compress` have been replaced by a `compression` parameter.","severity":"breaking","affected_versions":"Check versions after 2021.3.31 for deprecation and removal [9]."},{"fix":"Ensure your environment uses Python 3.8+ (64-bit recommended). Review usage of `TiffFile` to remove the `multifile` parameter if present [9, 13].","message":"The `multifile` parameter for `TiffFile` was removed. Support for Python 3.7 and earlier has been dropped, and Python 32-bit versions are deprecated.","severity":"breaking","affected_versions":">=2021.3.31"},{"fix":"Use `tifffile.memmap` for memory-efficient access to large files, or iterate through `TiffFile` pages to process chunks. Always use `TiffFile` within a `with` statement to ensure it is properly closed [3, 14].","message":"For very large TIFF files, loading the entire image into memory with `imread` can lead to `MemoryError`. Also, `TiffFile` objects should be properly closed.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be aware that `tifffile` supports a large subset but not all possible TIFF variations. Consult the documentation for specific format support, especially for proprietary formats [1, 4].","message":"Some TIFF-like formats do not strictly adhere to the TIFF6 specification, which might lead to unexpected behavior or incomplete data reading if not handled correctly.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If working with EER files, review code that decodes EER sub-pixels or parses EER metadata, as the API has changed. Refer to the latest documentation or release notes for the new approach [4, 6].","message":"Decoding EER super-resolution sub-pixels and parsing EER metadata to dict changed significantly, introducing breaking changes.","severity":"breaking","affected_versions":">=2026.3.3"},{"fix":"Ensure that the necessary build tools are installed in your environment before attempting to install `tifffile`. For Alpine Linux, this typically involves running `apk add build-base python3-dev`.","message":"When installing `tifffile` in minimal environments (like Alpine Linux), compilation of C extensions for optional dependencies such as `imagecodecs` and `numcodecs` may fail due to missing system build tools (e.g., `gcc`). This can lead to reduced functionality, as many compression and codec options provided by these dependencies will be unavailable.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'2026.3.3':55 'activ':44 'bigtiff':34,70 'bioimag':66 'continu':57 'current':52 'design':12 'develop':58 'extens':27 'file':6,18 'format':32 'frequent':48 'imag':24,62,65 'improv':60 'includ':33 'librari':11 'maintain':45 'microscopi':71 'multi':40 'multi-pag':39 'offer':26 'ome':36,68 'ome-tiff':35,67 'page':41 'particular':19 'preval':21 'process':63 'python':10 'read':2,14 'receiv':47 'reflect':56 'scientif':23,64 'stack':43 'support':28 'tiff':5,17,31,37,42,61,69 'tifffil':1,7 'updat':49 'various':30 'version':53 'write':4,16","created_at":"2026-03-29T08:39:39.973452+00:00","updated_at":"2026-04-16T22:56:48.325338+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":0,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2026.8.23","cli_name":"","cli_version":null,"type":"library","homepage":"https://www.cgohlke.com","github":"https://github.com/cgohlke/tifffile","docs":null,"changelog":null,"pypi":"https://pypi.org/project/tifffile/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-08-27","next_check":"2026-07-30","install_tag":"stale"}}