@@ -6,7 +6,8 @@ Image transformation, compression, and decompression codecs
6
6
7
7
Imagecodecs is a Python library that provides block-oriented, in-memory buffer
8
8
transformation, compression, and decompression functions for use in Tifffile,
9
- Czifile, Zarr 2, kerchunk, and other scientific image input/output packages.
9
+ Liffile, Czifile, Zarr 2, kerchunk, and other scientific image input/output
10
+ packages.
10
11
11
12
Decode and/or encode functions are implemented for Zlib (DEFLATE), GZIP, LZMA,
12
13
ZStandard (ZSTD), Blosc, Brotli, Snappy, BZ2, LZ4, LZ4F, LZ4HC, LZ4H5, LZW,
@@ -24,7 +25,7 @@ Jenkins lookup3.
24
25
25
26
:Author: `Christoph Gohlke <https://www.cgohlke.com >`_
26
27
:License: BSD 3-Clause
27
- :Version: 2024.12 .30
28
+ :Version: 2025.3 .30
28
29
:DOI: `10.5281/zenodo.6915978 <https://doi.org/10.5281/zenodo.6915978 >`_
29
30
30
31
Quickstart
@@ -53,44 +54,45 @@ Requirements
53
54
This revision was tested with the following requirements and dependencies
54
55
(other versions may work):
55
56
56
- - `CPython <https://www.python.org >`_ 3.10.11, 3.11.9, 3.12.8 , 3.13.1 64-bit
57
- - `Numpy <https://pypi.org/project/numpy >`_ 2.1.3
58
- - `numcodecs <https://pypi.org/project/numcodecs/ >`_ 0.14 .1
57
+ - `CPython <https://www.python.org >`_ 3.10.11, 3.11.9, 3.12.9 , 3.13.2 64-bit
58
+ - `Numpy <https://pypi.org/project/numpy >`_ 2.2.4
59
+ - `numcodecs <https://pypi.org/project/numcodecs/ >`_ 0.15 .1
59
60
(optional, for Zarr 2 compatible codecs)
60
61
61
62
Build requirements:
62
63
63
- - `Cython <https://github.com/cython/cython >`_ 3.0.11
64
+ - `Cython <https://github.com/cython/cython >`_ 3.0.12
64
65
- `brotli <https://github.com/google/brotli >`_ 1.1.0
65
66
- `brunsli <https://github.com/google/brunsli >`_ 0.1
66
67
- `bzip2 <https://gitlab.com/bzip2/bzip2 >`_ 1.0.8
67
68
- `c-blosc <https://github.com/Blosc/c-blosc >`_ 1.21.6
68
- - `c-blosc2 <https://github.com/Blosc/c-blosc2 >`_ 2.15.2
69
+ - `c-blosc2 <https://github.com/Blosc/c-blosc2 >`_ 2.17.1
69
70
- `charls <https://github.com/team-charls/charls >`_ 2.4.2
70
71
- `giflib <https://sourceforge.net/projects/giflib/ >`_ 5.2.2
71
72
- `jetraw <https://github.com/Jetraw/Jetraw >`_ 23.03.16.4
72
73
- `jxrlib <https://github.com/cgohlke/jxrlib >`_ 1.2
73
- - `lcms2 <https://github.com/mm2/Little-CMS >`_ 2.16
74
+ - `lcms2 <https://github.com/mm2/Little-CMS >`_ 2.17
74
75
- `lerc <https://github.com/Esri/lerc >`_ 4.0.4
75
76
- `libaec <https://gitlab.dkrz.de/k202009/libaec >`_ 1.1.3
76
- - `libavif <https://github.com/AOMediaCodec/libavif >`_ 1.1 .1
77
- (`aom <https://aomedia.googlesource.com/aom >`_ 3.11 .0,
78
- `dav1d <https://github.com/videolan/dav1d >`_ 1.5.0 ,
77
+ - `libavif <https://github.com/AOMediaCodec/libavif >`_ 1.2 .1
78
+ (`aom <https://aomedia.googlesource.com/aom >`_ 3.12 .0,
79
+ `dav1d <https://github.com/videolan/dav1d >`_ 1.5.1 ,
79
80
`rav1e <https://github.com/xiph/rav1e >`_ 0.7.1,
80
- `svt-av1 <https://gitlab.com/AOMediaCodec/SVT-AV1 >`_ 2.3.0
81
- `libyuv <https://chromium.googlesource.com/libyuv/libyuv >`_ main)
81
+ `svt-av1 <https://gitlab.com/AOMediaCodec/SVT-AV1 >`_ 2.3.0,
82
+ `libyuv <https://chromium.googlesource.com/libyuv/libyuv >`_ main,
83
+ `libxml2 <https://gitlab.gnome.org/GNOME/libxml2 >`_ 2.12.10)
82
84
- `libdeflate <https://github.com/ebiggers/libdeflate >`_ 1.23
83
- - `libheif <https://github.com/strukturag/libheif >`_ 1.19.5
85
+ - `libheif <https://github.com/strukturag/libheif >`_ 1.19.6
84
86
(`libde265 <https://github.com/strukturag/libde265 >`_ 1.0.15,
85
87
`x265 <https://bitbucket.org/multicoreware/x265_git/src/master/ >`_ 3.6)
86
88
- `libjpeg-turbo <https://github.com/libjpeg-turbo/libjpeg-turbo >`_ 3.1.0
87
89
- `libjxl <https://github.com/libjxl/libjxl >`_ 0.11.1
88
90
- `libjxs <https://jpeg.org/jpegxs/software.html >`_ 2.0.2
89
- - `liblzma <https://github.com/tukaani-project/xz >`_ 5.6.3
90
- - `libpng <https://github.com/glennrp/libpng >`_ 1.6.44
91
- - `libpng-apng <https://sourceforge.net/projects/libpng-apng/ >`_ 1.6.44
91
+ - `liblzma <https://github.com/tukaani-project/xz >`_ 5.6.4
92
+ - `libpng <https://github.com/glennrp/libpng >`_ 1.6.47
93
+ - `libpng-apng <https://sourceforge.net/projects/libpng-apng/ >`_ 1.6.47
92
94
- `libtiff <https://gitlab.com/libtiff/libtiff >`_ 4.7.0
93
- - `libultrahdr <https://github.com/google/libultrahdr >`_ 1.3 .0
95
+ - `libultrahdr <https://github.com/google/libultrahdr >`_ 1.4 .0
94
96
- `libwebp <https://github.com/webmproject/libwebp >`_ 1.5.0
95
97
- `lz4 <https://github.com/lz4/lz4 >`_ 1.10.0
96
98
- `lzfse <https://github.com/lzfse/lzfse/ >`_ 1.0
@@ -99,14 +101,14 @@ Build requirements:
99
101
- `mozjpeg <https://github.com/mozilla/mozjpeg >`_ 4.1.5
100
102
- `openjpeg <https://github.com/uclouvain/openjpeg >`_ 2.5.3
101
103
- `pcodec <https://github.com/mwlon/pcodec >`_ 0.3.1 (0.4.0 crashes)
102
- - `snappy <https://github.com/google/snappy >`_ 1.2.1
104
+ - `snappy <https://github.com/google/snappy >`_ 1.2.2
103
105
- `sperr <https://github.com/NCAR/SPERR >`_ 0.8.2
104
106
- `sz3 <https://github.com/szcompressor/SZ3 >`_ 3.1.8 (3.2.x crashes)
105
107
- `zfp <https://github.com/LLNL/zfp >`_ 1.0.1
106
108
- `zlib <https://github.com/madler/zlib >`_ 1.3.1
107
- - `zlib-ng <https://github.com/zlib-ng/zlib-ng >`_ 2.2.2
109
+ - `zlib-ng <https://github.com/zlib-ng/zlib-ng >`_ 2.2.4
108
110
- `zopfli <https://github.com/google/zopfli >`_ 1.0.3
109
- - `zstd <https://github.com/facebook/zstd >`_ 1.5.6
111
+ - `zstd <https://github.com/facebook/zstd >`_ 1.5.7
110
112
111
113
Vendored requirements:
112
114
@@ -129,25 +131,34 @@ Vendored requirements:
129
131
130
132
Test requirements:
131
133
132
- - `tifffile <https://github.com/cgohlke/tifffile >`_ 2024.12.12
133
- - `czifile <https://github.com/cgohlke/czifile >`_ 2019.7.2
134
- - `zarr <https://github.com/zarr-developers/zarr-python >`_ 2.18.4
134
+ - `tifffile <https://github.com/cgohlke/tifffile >`_ 2025.3.30
135
+ - `czifile <https://github.com/cgohlke/czifile >`_ 2019.7.2.1
136
+ - `liffile <https://github.com/cgohlke/liffile >`_ 2025.3.8
137
+ - `zarr <https://github.com/zarr-developers/zarr-python >`_ 2.18.5
135
138
- `python-blosc <https://github.com/Blosc/python-blosc >`_ 1.11.2
136
- - `python-blosc2 <https://github.com/Blosc/python-blosc2 >`_ 2.7 .1
137
- - `python-brotli <https://github.com/google/brotli/tree/master/python >`_ 1.0.9
138
- - `python-lz4 <https://github.com/python-lz4/python-lz4 >`_ 4.3 .3
139
+ - `python-blosc2 <https://github.com/Blosc/python-blosc2 >`_ 3.2 .1
140
+ - `python-brotli <https://github.com/google/brotli/tree/master/python >`_ 1.1.0
141
+ - `python-lz4 <https://github.com/python-lz4/python-lz4 >`_ 4.4 .3
139
142
- `python-lzf <https://github.com/teepark/python-lzf >`_ 0.2.6
140
- - `python-snappy <https://github.com/andrix/python-snappy >`_ 0.7.2
141
- - `python-zstd <https://github.com/sergey-dryabzhinsky/python-zstd >`_ 1.5.5.1
143
+ - `python-snappy <https://github.com/andrix/python-snappy >`_ 0.7.3
144
+ - `python-zstd <https://github.com/sergey-dryabzhinsky/python-zstd >`_ 1.5.6
142
145
- `pyliblzfse <https://github.com/ydkhatri/pyliblzfse >`_ 0.4.1
143
- - `zopflipy <https://github.com/hattya/zopflipy >`_ 1.10
146
+ - `zopflipy <https://github.com/hattya/zopflipy >`_ 1.11
144
147
145
148
Revisions
146
149
---------
147
150
151
+ 2025.3.30
152
+
153
+ - Pass 7659 tests.
154
+ - Fix some codecs for use with Zarr 3, zarr_format=2 (#123).
155
+ - Fix lz4h5 codec when block size is less than compressed size (#126).
156
+ - Fix pglz_compress is not thread-safe.
157
+ - Set __module__ attribute on public objects.
158
+ - Drop support for Python 3.9, deprecate Python 3.10.
159
+
148
160
2024.12.30
149
161
150
- - Pass 7655 tests.
151
162
- Fix out parameter array not zeroed in some cases.
152
163
- Fix ultrahdr_encode with linear rgbaf16 input (#108).
153
164
- Fix jpegls_encode with level greater than 9 (#119).
@@ -197,30 +208,30 @@ Refer to the CHANGES file for older revisions.
197
208
Objectives
198
209
----------
199
210
200
- Many scientific image storage formats like TIFF, CZI, DICOM, HDF, and Zarr
201
- are containers that hold large numbers of small data segments (chunks, tiles,
202
- stripes), which are encoded using a variety of compression and pre-filtering
203
- methods. Metadata common to all data segments are typically stored separate
204
- from the segments.
211
+ Many scientific image storage formats, such as TIFF, CZI, XLIF, DICOM, HDF,
212
+ and Zarr are containers that store numerous small data segments (chunks, tiles,
213
+ stripes). These segments are encoded using various compression and
214
+ pre-filtering methods. Metadata common to all data segments are typically
215
+ stored separately from the segments.
205
216
206
217
The purpose of the Imagecodecs library is to support Python modules in
207
218
encoding and decoding such data segments. The specific aims are:
208
219
209
220
- Provide functions for encoding and decoding small image data segments
210
- in-memory (not in-file) from and to bytes or numpy arrays for many
221
+ in-memory (as opposed to in-file) from and to bytes or numpy arrays for many
211
222
compression and filtering methods.
212
- - Support image formats and compression methods not available elsewhere in
213
- the Python ecosystem.
223
+ - Support image formats and compression methods that are not available
224
+ elsewhere in the Python ecosystem.
214
225
- Reduce the runtime dependency on numerous, large, inapt, or unmaintained
215
- Python packages. The imagecodecs package only depends on numpy.
216
- - Implement codecs as Cython wrappers of 3rd party libraries with a C API
217
- and permissive license if exists, else use own C library.
226
+ Python packages. The Imagecodecs package only depends on numpy.
227
+ - Implement codecs as Cython wrappers of third- party libraries with a C API
228
+ and permissive license if available; otherwise use own C library.
218
229
Provide Cython definition files for the wrapped C libraries.
219
230
- Release the Python global interpreter lock (GIL) during extended native/C
220
231
function calls for multi-threaded use.
221
232
222
233
Accessing parts of large data segments and reading metadata from segments
223
- are out of the scope of this library.
234
+ are outside the scope of this library.
224
235
225
236
Notes
226
237
-----
@@ -229,7 +240,7 @@ This library is largely a work in progress.
229
240
230
241
The API is not stable yet and might change between revisions.
231
242
232
- Python <= 3.8 is no longer supported. 32-bit versions are deprecated.
243
+ Python <= 3.9 is no longer supported. 32-bit versions are deprecated.
233
244
234
245
Works on little-endian platforms only.
235
246
@@ -429,11 +440,12 @@ Create a JPEG 2000 compressed Zarr 2 array:
429
440
... chunks = (1 , 1 , 256 , 256 , 3 ),
430
441
... dtype = ' u1' ,
431
442
... compressor = Jpeg2k(),
443
+ ... zarr_format = 2 ,
432
444
... )
433
- < zarr.core. Array (4 , 5 , 512 , 512 , 3 ) uint8>
445
+ < ... Array ... (4 , 5 , 512 , 512 , 3 ) ... uint8>
434
446
435
447
Access image data in a sequence of JP2 files via tifffile.FileSequence and
436
- dask.array:
448
+ dask.array (requires Zarr 2) :
437
449
438
450
.. code-block :: python
439
451
0 commit comments