This release is a pre-release and may not be stable for production use.
clearscale
clearscale is a dependency-free Python library for reading, transforming, and writing multiscale image metadata.
It provides an abstraction layer between image-processing code and metadata formats such as OME-Zarr. Work with named axes, shapes, pixel sizes, and spatial relations; clearscale handles the format-specific parsing and serialization. Your application keeps control of array storage, image processing, and the user interface.
What it provides
- Axis-aware metadata: Immutable, ordered mappings keep axis names attached to their shapes, pixel size, unit and translation values through reordering, insertions and drops.
- Multiscale planning: Shape and factor blueprints describe resolution levels and can drive your processing code. Scaling method characterization helps you calculate the corresponding pixel sizes and translations.
- OME-Zarr support: Read versions 0.1–0.6 through a common API and write versions 0.4, 0.5, and 0.6, with validation during construction and serialization. See feature coverage.
- Spatial relationships: Describe alternate coordinate systems, affine transformations, and relations between images, including OME-Zarr 0.6 scenes.
- A small integration footprint: Pure Python, no runtime dependencies, and typed APIs designed to work with ordinary Python mappings and your choice of array and storage libraries.
Installation
Requires Python 3.10 or newer.
pip install clearscale==0.9.0rc3
Conda packages are available from the maintainer's btbest channel:
conda install -c btbest clearscale==0.9.0rc3
The 0.9 series is in beta; the public API may change before 1.0.
Metadata-only quickstart
Suppose your application has written an image array with axes zyx at path s0 within a Zarr group.
Here is how to describe its shape and physical pixel sizes, and prepare OME-Zarr metadata:
import clearscale as cs
shape = cs.Shape(z=16, y=64, x=64)
pixel_size = cs.PixelSize(z=0.5, y=0.25, x=0.25)
unit = cs.Unit(z="micrometer", y="micrometer", x="micrometer")
# A Scale describes one array
scale = cs.Scale(shape=shape, pixel_size=pixel_size, unit=unit)
# A Multiscale describes the image the Scale belongs to
multiscale = cs.Multiscale.from_single(scale, scale_key="s0")
# An OmeZarrGroup prepares the metadata for a Zarr group's attributes
ome_attrs = cs.OmeZarrGroup.from_single(multiscale).to_attrs(version="0.5")
Attach ome_attrs to the group using your Zarr library.
Typically:
zarr_group.attrs.update(ome_attrs).
The axis order, shape, pixel sizes, and array path should describe the data you actually wrote. For OME-Zarr 0.5 and 0.6, the underlying store must use Zarr format 3.
This example uses only clearscale. For complete examples that also create, scale and store arrays, see documentation.
Keeping data and metadata together
For an image pyramid, BlueprintShapes and BlueprintFactors describe the target shapes or scaling factors for each resolution level.
You can use a blueprint to drive array processing, then apply it to a base Scale to describe the resulting multiscale image using cs.Multiscale.from_single(scale, blueprint=...).
If your arrays already exist, and you know how the image was scaled, you can also build metadata from their recorded shapes. Array shapes alone cannot tell you where the output samples lie. Hence, clearscale asks for the scaling method's rounding, pixel-sizing, and translation behavior. The characterization tools help determine these properties for your actual processing function.
Where clearscale fits
The OME-Zarr ecosystem benefits from the work of projects such as bioio, ngff-zarr, ngio, ome-zarr-py, and yaozarrs. The NGFF tools directory is a useful overview of the wider ecosystem.
clearscale focuses on the metadata layer for applications, libraries, and scripts that already have their own storage and processing choices. This narrow scope keeps it easy to integrate into an existing environment. It works only with metadata, leaving data access, resampling, chunking and compression to the tools you choose for those jobs.
Documentation
The documentation includes practical guides and the full API reference:
- OME-Zarr integration: read, inspect, and write metadata across versions.
- Core concepts: axis values, scales, multiscales, and blueprints.
- Scaling methods: match metadata to the behavior of your processing code.
- Coordinate systems and scenes: describe spatial context and relationships between images.
Contributing
Questions, bug reports, and contributions are welcome. If something is awkward to express in your application, please let us know!
See CONTRIBUTING.md for development instructions and project scope, or open an issue.
License
Licensed under either the MIT license or the Apache License, Version 2.0, at your option.
Metadata
Release files for clearscale 0.9.0rc3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| clearscale-0.9.0rc3.tar.gz | 480.9 kB | With provenance | Details for clearscale-0.9.0rc3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| clearscale-0.9.0rc3-py3-none-any.whl | Python 3 | none | any | Details for clearscale-0.9.0rc3-py3-none-any.whl |
Total release size: 633.9 kB
Release files / clearscale-0.9.0rc3.tar.gz
| Download URL | clearscale-0.9.0rc3.tar.gz |
|---|---|
| Size | 480.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
256ffc274acc1d445f277452a0dc78d3f061508686d46545b569aa3058f31196
|
|
BLAKE2b-256 checksum How to use checksums |
beec61edaf65e2251f5e2658a9f34fb2c93072e367b5940e92b15bb2e3dba25c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logRelease files / clearscale-0.9.0rc3-py3-none-any.whl
| Download URL | clearscale-0.9.0rc3-py3-none-any.whl |
|---|---|
| Size | 153.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f24e913a0f1245dc8ea933a98aa95942d07c718502df398a6123e8d85b72e0a9
|
|
BLAKE2b-256 checksum How to use checksums |
70af8bfe4d2c4250100d9bbcab1f979876e98f6cdae19a906d030269f7e2ae5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logSecurity for clearscale 0.9.0rc3
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for clearscale-0.9.0rc3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logA 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.