Skip to main content

pytest cargo test

Tiffwrite

Write BioFormats/ImageJ compatible tiffs with zstd compression in parallel using Rust.

Features

  • Writes bigtiff files that open in ImageJ as hyperstack with correct dimensions.
  • Parallel compression.
  • Write individual frames in random order.
  • Compresses even more by referencing tag or image data which otherwise would have been saved several times. For example empty frames, or a long string tag on every frame. Editing tiffs becomes mostly impossible, but compression makes that very hard anyway.
  • Enables memory efficient scripts by saving frames whenever they're ready to be saved, not waiting for the whole stack.
  • Colormaps
  • Extra tags, globally or frame dependent.

Python

Installation

pip install tiffwrite

or

  • install rust
  • pip install tiffwrite@git+https://git.pomppervova.nl/wim/tiffwrite

Usage

Write an image stack

tiffwrite(file, data, axes='TZCXY', dtype=None, bar=False, *args, **kwargs)
  • file: string; filename of the new tiff file.
  • data: 2 to 5D numpy array in one of these datatypes: (u)int8, (u)int16, float32.
  • axes: string; order of dimensions in data, default: TZCXY for 5D, ZCXY for 4D, CXY for 3D, XY for 2D data.
  • dtype: string; cast data to dtype before saving, only (u)int8, (u)int16 and float32 are supported.
  • bar: bool; whether to show a progress bar.
  • args, kwargs: arguments to be passed to IJTiffFile, see below.

Write one frame at a time

with IJTiffFile(file, dtype='uint16', colors=None, colormap=None, pxsize=None, deltaz=None,
                timeinterval=None, **extratags) as tif:
some loop:
    tif.save(frame, c, z, t)
  • path: string; path to the new tiff file.

  • dtype: string; cast data to dtype before saving, only (u)int8, (u)int16 and float32 are supported by Fiji.

  • colors: iterable of strings; one color per channel, valid colors (also html) are defined in matplotlib.colors. Without colormap BioFormats will set the colors in this order: rgbwcmy. Note that the color green is dark, the usual green is named 'lime' here.

  • colormap: string; choose any colormap from the colorcet module. Colors and colormap cannot be used simultaneously.

  • pxsize: float; pixel size im um.

  • deltaz: float; z slice interval in um.

  • timeinterval: float; time between frames in seconds.

  • compression: int; zstd compression level: -7 to 22.

  • comment: str; comment to be saved in tif

  • extratags: Sequence[Tag]; other tags to be saved, example: Tag.ascii(315, 'John Doe') or Tag.ascii(33432, 'Made by me').

  • frame: 2D numpy array with data.

  • c, z, t: int; channel, z, time coordinates of the frame.

Examples

Write an image stack

from tiffwrite import tiffwrite
import numpy as np

image = np.random.randint(0, 255, (5, 3, 64, 64), 'uint16')
tiffwrite('file.tif', image, 'TCXY')

Write one frame at a time

from tiffwrite import IJTiffFile
import numpy as np

with IJTiffFile('file.tif', pxsize=0.09707) as tif:
    for c in range(3):
        for z in range(5):
            for t in range(10):
                tif.save(np.random.randint(0, 10, (32, 32)), c, z, t)

Saving multiple tiffs simultaneously

from tiffwrite import IJTiffFile
import numpy as np

with IJTiffFile('fileA.tif') as tif_a, IJTiffFile('fileB.tif') as tif_b:
    for c in range(3):
        for z in range(5):
            for t in range(10):
                tif_a.save(np.random.randint(0, 10, (32, 32)), c, z, t)
                tif_b.save(np.random.randint(0, 10, (32, 32)), c, z, t)

Rust

use ndarray::Array2;
use tiffwrite::IJTiffFile;

{  // f will be closed when f goes out of scope
    let mut f = IJTiffFile::new("file.tif")?;
    for c in 0..3 {
        for z in 0..5 {
            for t in 0..10 {
                let arr = Array2::<u16>::zeros((100, 100));
                f.save(&arr, c, z, t)?;
            }
        }
    }
}

Tricks & tips

  • The order of feeding frames to IJTiffFile is unimportant, IJTiffFile will order the ifd's such that the file will be opened as a correctly ordered hyperstack.
  • Using the colormap parameter you can make ImageJ open the file and apply the colormap. colormap='glasbey' is very useful.

Metadata

Release files for tiffwrite 2026.6.0

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

Source distribution (sdist)

Source distribution for tiffwrite 2026.6.0
File Size Uploaded
tiffwrite-2026.6.0.tar.gz 35.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for tiffwrite 2026.6.0
File
tiffwrite-2026.6.0-cp310-abi3-win_arm64.whl CPython 3.10 abi3 Windows ARM64 Details
tiffwrite-2026.6.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
tiffwrite-2026.6.0-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
tiffwrite-2026.6.0-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details
tiffwrite-2026.6.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
tiffwrite-2026.6.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
tiffwrite-2026.6.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
tiffwrite-2026.6.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 17.9 MB

Release files / tiffwrite-2026.6.0.tar.gz

Download URL tiffwrite-2026.6.0.tar.gz
Size 35.5 kB
Tags Source
SHA-256 checksum
How to use checksums
15ee6e1df6e1743084a091c238fd1f3f9fb7374e24c05254d04909ee06ae1b1b
BLAKE2b-256 checksum
How to use checksums
abaeedb8bada7c1eb53bc2dc9aaa366815c7de05acec4f16ad3b09bb393afb19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / tiffwrite-2026.6.0-cp310-abi3-win_arm64.whl

Download URL tiffwrite-2026.6.0-cp310-abi3-win_arm64.whl
Size 1.7 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
9d8af68324f2c2565ff45e31a33cf5fe6ea9f8eeb12bc64a21e60ef3f306c29f
BLAKE2b-256 checksum
How to use checksums
365741645df36ca720ea43b3347df5d3f509ec297229ec91cb1c96827fa646d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / tiffwrite-2026.6.0-cp310-abi3-win_amd64.whl

Download URL tiffwrite-2026.6.0-cp310-abi3-win_amd64.whl
Size 1.8 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
60da8a3c078a2ad0d61ad84c7b80b13f925b5e936369ce43d9f68af58d9c85b9
BLAKE2b-256 checksum
How to use checksums
18e8a43ffeab74bead7ea3573f7f2d483961824b700161dd0c7e24b21d4ac7eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / tiffwrite-2026.6.0-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL tiffwrite-2026.6.0-cp310-abi3-musllinux_1_2_x86_64.whl
Size 2.0 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
5bedc6f07177f108c31f4bdb98a7fcf57ad4f1a44a2d79f04f88c8549fc739cf
BLAKE2b-256 checksum
How to use checksums
1d774b90035230ffff0744cfad92587cc92618427a0e9225c63b468864891c8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / tiffwrite-2026.6.0-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL tiffwrite-2026.6.0-cp310-abi3-musllinux_1_2_aarch64.whl
Size 1.9 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
1c1c8afb7e855cda5a22e02311270186bc1e7545415d3e88f85cf893e2b15151
BLAKE2b-256 checksum
How to use checksums
15e7ae5c57f2956baa44b46ec44b96522431ad97be50a0f3527bf4d2666836c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / tiffwrite-2026.6.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL tiffwrite-2026.6.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.0 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
808762329ccf2e1be0e6ce9e64dc584afc6fc3039ffa0abe76c4565e7f9631a2
BLAKE2b-256 checksum
How to use checksums
311b39f73005e3cf0bcafd56e5c2e88fc5cf7a80db867f3d2dbd3601e91b7aa8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / tiffwrite-2026.6.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL tiffwrite-2026.6.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.9 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
4b89e8319449beb9a0b91b8d7b4b487454f57ef30ca8b5521641a0c4c09dbb83
BLAKE2b-256 checksum
How to use checksums
8258e637db3e54bd4ca1e9248bbef2c66e28e29478c62c3e82266dbefa90db8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / tiffwrite-2026.6.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL tiffwrite-2026.6.0-cp310-abi3-macosx_11_0_arm64.whl
Size 3.2 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
aa993e42f9f27f3ad5b0b565a29d88d04760448c59b9f0d26bf605b219b99d2e
BLAKE2b-256 checksum
How to use checksums
ee6ddfb9bb1a4644b7e88ae20f6b57a5716b47347c3166bd0f0c000766173b90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / tiffwrite-2026.6.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL tiffwrite-2026.6.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 3.3 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c569636f0f7470d459b7b72c2f56dedb8817f075069ee30a83c6c7486a537bae
BLAKE2b-256 checksum
How to use checksums
2ab287bbbf0d797eda981fb31a60d14411efe24732c466516fc0dfc880af4435
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

2026.6.0 This release

9 release files

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