geotiff-rust
Pure-Rust TIFF/BigTIFF and GeoTIFF/COG readers and writers. No C libraries, no build scripts, no unsafe beyond memmap2.
Crates
| Crate | Description |
|---|---|
tiff-core |
Shared types: ByteOrder, TagType, TagValue, TiffSample, compression/predictor enums |
tiff-reader |
TIFF/BigTIFF decoder with mmap, strip/tile reads, and typed raster decode |
tiff-writer |
TIFF/BigTIFF encoder with streaming writes, compression, predictors, and BigTIFF |
geotiff-core |
Shared GeoTIFF types: GeoKeyDirectory, CRS, GeoTransform, tag constants |
geotiff-reader |
GeoTIFF reader with CRS/transform extraction, overview discovery, and optional HTTP COG access |
geotiff-writer |
GeoTIFF/COG writer with fluent builder, streaming tile writes, and overview generation |
Reading
use GeoTiffFile;
let file = open?;
println!;
let raster: ArrayD = file.read_raster?;
Writing
use ;
use Array2;
let data = zeros;
new
.epsg
.pixel_scale
.origin
.nodata
.compression
.write_2d?;
For separate-planar multiband output, set
planar_configuration(PlanarConfiguration::Planar) on ImageBuilder or
GeoTiffBuilder.
Streaming tile writes
use GeoTiffBuilder;
use Array2;
let builder = new
.tile_size
.epsg;
let mut writer = builder.?;
for in tiles
writer.finish?;
COG with overviews
use ;
use Array2;
let data = zeros;
new
.overview_levels
.resampling
.write_2d?;
Features
Read
- Classic TIFF and BigTIFF
- Little-endian and big-endian byte orders
- Strip and tile data access with windowed reads
- Chunky and separate planar sample layouts
- Compression: Deflate, LZW, PackBits, JPEG (optional), ZSTD (optional)
- Parallel decompression via Rayon
- Typed raster reads into
ndarray::ArrayD(u8 through f64) - GeoKey directory, CRS/EPSG, transforms, NoData, overview discovery
- Optional HTTP range-backed remote COG access
Write
- Classic TIFF and BigTIFF with auto-detection
- Strip and tile layouts
- Compression: Deflate, LZW, ZSTD (optional)
- Predictors: horizontal differencing, floating-point byte interleaving
- Chunky and separate planar multi-band layouts (RGB/RGBA) and all sample types (u8 through f64)
- Streaming tile-by-tile writes for large rasters
- GeoTIFF metadata: EPSG, pixel scale, origin, affine transforms, NoData
- COG output with ghost IFD, overview generation (nearest-neighbor, average)
Feature flags
| Flag | Default | Description |
|---|---|---|
local |
yes | Local file reading via tiff-reader (geotiff-reader) |
rayon |
yes | Parallel strip/tile decompression (tiff-reader, geotiff-reader) |
jpeg |
yes | JPEG-in-TIFF support (tiff-reader) |
zstd |
yes | ZSTD compression (tiff-reader, tiff-writer) |
cog |
no | HTTP range-backed remote COG open (geotiff-reader) |
Testing
Reference-library parity tests are included for tiff-reader and
geotiff-reader. They compare this workspace against GDAL/libtiff when those
tools are available locally; otherwise they self-skip. Lossless codecs use
exact byte and hash parity. The JPEG fixture uses a strict bounded-delta check
because compliant decoders can differ by +/-1 in a small number of samples.
For a reproducible reference environment, run the Docker harness:
For reference comparisons and current benchmark results against GDAL/libtiff, see docs/benchmark-report.md.
License
MIT OR Apache-2.0