Portable data compression library for MATLAB/Octave, Python and C/Fortran
🗜️ What is ZMat?
ZMat provides a fast, portable C compression library (libzmat) with bindings for MATLAB/Octave (MEX) and Python (C extension). A single unified API gives you access to 12 codecs with zero external dependencies.
🏆 NeuroJSON Project
Part of the NeuroJSON project (neurojson.org), funded by NIH grant U24-NS124027. Powers compression in JSONLab, JNIfTI and other NeuroJSON tools.
⚙️ Supported Codecs
| Method | Speed | Ratio | Best For |
|---|---|---|---|
| lz4 | ⚡⚡⚡⚡⚡ | ⭐⭐ | Real-time / streaming |
| zlib / gzip | ⚡⚡⚡⚡ | ⭐⭐⭐ | Balanced; wide compatibility |
| zstd | ⚡⚡⚡ | ⭐⭐⭐⭐ | Modern high-throughput |
| lz4hc | ⚡⚡⚡ | ⭐⭐⭐ | LZ4 with better ratio |
| lzma / lzip | ⚡ | ⭐⭐⭐⭐⭐ | Maximum compression |
| blosc2* | ⚡⚡⚡⚡ | ⭐⭐⭐⭐ | N-D numeric arrays |
| base64 | ⚡⚡⚡⚡⚡ | — | Text-safe encoding |
* blosc2 variants: blosclz, lz4, lz4hc, zlib, zstd
⚡ Performance Guide
🚀 Ultra-Fast — LZ4
- Fastest compress & decompress
- Ideal for real-time pipelines
- Level 1–9
⚖️ Balanced — zlib / zstd
- Industry-standard algorithms
- Python stdlib interoperable
- Level 1–9 (zstd up to 22)
🎯 Smallest — LZMA
- Highest compression ratio
- Best for archival/cold storage
- Level 1–9
🔬 Scientific — Blosc2
- Optimized for N-D arrays
- Byte-shuffle pre-filter
- Multi-threaded (nthread)
![[Home]](upload/neurojson_banner_plain.png)
