codecs
codecs
¶
Zarr v3 codecs for image compression.
WebPCodec
dataclass
¶
Bases: ArrayBytesCodec
WebP image codec for zarr v3 using OpenCV.
Compresses uint8 image array chunks using WebP encoding. Chunks should contain a single image with shape (1, H, W, C) for optimal compression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
int
|
WebP quality level (1-100). Higher is better quality but larger files. Default 99 provides near-lossless quality at ~35% less space than JPEG at the same quality. |
99
|
Source code in src/versatil/data/preprocessing/codecs.py
from_dict
classmethod
¶
Build the codec from a Zarr named-configuration dict.
Source code in src/versatil/data/preprocessing/codecs.py
to_dict
¶
Serialize the codec as a Zarr named-configuration dict.
compute_encoded_size
¶
Encoded size is data-dependent for WebP, so it cannot be precomputed.