v0.1-alpha
libviprs logo

libviprs

/lɪb-ˈvaɪ·pərz/

A pure-Rust, thread-safe image pyramiding engine for the AEC/construction domain.

CI Merge Gate Rust 1.85+ MIT License

Takes blueprint PDFs and images, extracts raster data, optionally geo-references it, and generates tile pyramids (DeepZoom, XYZ) suitable for web-based viewers. Inspired by libvips, built from scratch.

Features

Quick Start

use libviprs::{
    extract_page_image, generate_pyramid, BlankTileStrategy,
    EngineConfig, FsSink, Layout, PyramidPlanner, TileFormat,
};
use std::path::Path;

// Extract raster from a scanned blueprint PDF
let raster = extract_page_image(Path::new("blueprint.pdf"), 1).unwrap();

// Plan the pyramid
let planner = PyramidPlanner::new(
    raster.width(), raster.height(),
    256, 0, Layout::DeepZoom,
).unwrap();
let plan = planner.plan();

// Generate tiles to disk
let sink = FsSink::new("output_tiles", plan.clone(), TileFormat::Png);
let config = EngineConfig::default()
    .with_concurrency(4)
    .with_blank_tile_strategy(BlankTileStrategy::Placeholder);
let result = generate_pyramid(&raster, &plan, &sink, &config).unwrap();

println!(
    "{} tiles across {} levels ({} blank tiles skipped)",
    result.tiles_produced, result.levels_processed, result.tiles_skipped,
);

Modules

ModuleDescription
sourceImage decoding (JPEG, PNG, TIFF) into canonical Raster
pdfPDF parsing (lopdf) and optional rendering (PDFium)
rasterPixel buffer, region views, format normalization
pixelPixel format definitions (Gray8, RGB8, RGBA8, 16-bit)
plannerTile math, level computation, layout generation
resizeDownscaling for pyramid levels
engineMulti-threaded tile extraction with backpressure
sinkTile output (filesystem, memory, slow sink for testing)
geoAffine geo-transform, GCP solving, bounding box
observeProgress events, memory tracking

Requirements

Related Crates

CrateDescription
libviprs-cliCommand-line interface (viprs binary)
libviprs-testsIntegration tests and fixtures