@bitruvius/ript
v0.3.1
Published
RIPT decoder: scientific raster tiles decoded in the browser with SIMD wasm kernels
Readme
@bitruvius/ript
Scientific rasters, decoded in the browser at near-native speed.
RIPT (Raster Image Predictive Tiling) picks the best predictor for each tile, SIMD-encodes the result, and delivers extreme compression in lossy modes: elevation compresses up to 200× at 1m vertical error. Elevation, classification, multispectral, SAR, LiDAR, satellite and medical imagery, across 14 pixel data types, lossless or lossy.
Powered by Bitruvius RIPT, a Bitruvius flagship codec.
This package is the browser decoder: pure-Rust wasm, no emscripten, nothing to configure per tile. Decode runs on the calling thread, so put it in a worker yourself if you are decoding enough tiles to notice.
The numbers
Lossless compression ratios, median across the matched corpus. All medians come from the canonical Auto+Zstd configuration.
| Data | Ratio | |---|---| | Lidar Classification | 20.6× | | Multispectral | 6.4× | | Lidar Intensity | 2.3× | | LiDAR DEM | 2.1× | | LiDAR DSM | 1.8× | | SAR Quicklook | 1.3× |
Native decode throughput, median, single-threaded, AVX2.
| Data | Throughput | |---|---| | Multispectral (256×256 tiles) | 2.3 GB/s | | LiDAR DEM | 1.6 GB/s | | LiDAR DSM | 1.5 GB/s | | Lidar Classification | 1.1 GB/s | | Terrain Aspect | 920 MB/s |
That speed largely survives the trip to the browser: in-browser decode runs at 60–107% of native AVX2 speed.
Lossy. At 1m vertical error on elevation, RIPT delivers 87× median and 200×+ peak. Smoothed, meter-quantized basemap DEMs go further: 1,520× on Mt Everest terrain, 5,958× on Pacific bathymetry.
Use it
import { RiptDecoder } from '@bitruvius/ript';
const bytes = new Uint8Array(await (await fetch(TILE_URL)).arrayBuffer());
const tile = await new RiptDecoder().decode(bytes);
// { width: 1024, height: 1024, dtype: 'Float32', bands: 1, lossy: false, values }
// `values` is typed ArrayBufferView | ArrayBufferView[]; narrow it on `dtype`.
const dem = tile.values as Float32Array;That is the whole API surface you need. The header is self-describing, so there
are no dimensions, no data type and no value range to pass in. Multiband tiles
(bands > 1) come back as one typed array per band. decoder.inspect(bytes)
resolves the header alone when you only want to know what a tile holds.
Entropy coding is handled inside the codec. Uncompressed, LZ4 and Zstd tiles all
go through the same decode() call and produce identical values, which the
package asserts in its conformance tests against the shipped wasm.
Install
npm i @bitruvius/riptThe wasm resolves next to the bundle, so a browser build needs nothing else. In
Node and Bun there is no sibling fetch, so hand the decoder the bytes:
new RiptDecoder({ wasmInit: { wasmBytes } }). Under a strict CSP, allow
script-src 'wasm-unsafe-eval'. A self-contained ESM bundle is also published on
the Bitruvius CDN if you would rather skip the bundler entirely.
This package decodes. It does not encode. The decoder is free: anyone who needs to read RIPT-encoded data can pull it and ship it. Production encoding requires a paid commercial license, with tiers, seats, transactions and OEM redistribution listed on the Bitruvius pricing page.
Learn more
- Live examples: running, with source
- Documentation: guides and the full API reference
- Support: questions and issues
- RIPT on bitruvius.com: benchmarks and format details
- Scientific Codec Race: RIPT decoding head-to-head against TurboLERC and the Esri LERC reference, live in your browser, no install
Trademarks
Esri and LERC are trademarks of Environmental Systems Research Institute, Inc. TurboLERC, Zstandard, LZ4 and all other product and format names are trademarks of their respective owners.
These names are used solely to describe the data formats this software interoperates with. Bitruvius is not affiliated with, sponsored by, or endorsed by any of them, and no such relationship is implied.
License
Proprietary. The full terms ship as LICENSE inside this package, and are readable
before installing at cdn.bitruvius.com/legal/sdk-license-v1.txt.
© Bitruvius, Inc.
