Skip to content

Commit 2c08385

Browse files
committed
add image codecs test
1 parent 47997e3 commit 2c08385

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

examples/image_codecs.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# /// script
2+
# requires-python = ">=3.11"
3+
# dependencies = [
4+
# "zarr @ file:///home/bennettd/dev/zarr-python/",
5+
# "imagecodecs==2025.3.30"
6+
# ]
7+
# ///
8+
9+
# "zarr @ git+https://github.com/zarr-developers/zarr-python.git@main",
10+
11+
import numcodecs
12+
import numpy as np
13+
from imagecodecs.numcodecs import Jpeg
14+
15+
import zarr
16+
17+
numcodecs.register_codec(Jpeg)
18+
jpg_codec = Jpeg()
19+
store = {}
20+
21+
z_w = zarr.create_array(
22+
store=store, data=np.zeros((100, 100, 3), dtype=np.uint8), serializer=jpg_codec, zarr_format=3
23+
)
24+
25+
# breakpoint()
26+
27+
z_r = zarr.open_array(store=store, zarr_format=3)
28+
29+
print(z_r.metadata.to_dict()["codecs"])

0 commit comments

Comments
 (0)