Expand description
§Outline
Image background removal with flexible mask processing options.
Powered by ONNX Runtime (ort) and VTracer, and works with U2-Net, BiRefNet,
and other ONNX models with a compatible input/output shape.
§Quick Start
use outline::Outline;
let outline = Outline::new("model.onnx");
let session = outline.for_image("input.png")?;
let matte = session.matte();
// Compose the foreground directly from the raw matte (soft edges)
let foreground = matte.foreground()?;
foreground.save("foreground.png")?;
// Process the mask and save it
let mask = matte.blur().threshold().processed()?;
mask.save("mask.png")?;Structs§
- Foreground
Handle - Composed RGBA foreground image with transparent background.
- Inference
Settings - Configuration for ONNX model inference and image preprocessing.
- Inferenced
Matte - Inference result containing the original RGB image and raw matte prediction.
- Mask
Handle - Processed mask image with optional further refinement and output generation.
- Mask
Processing Options - Configuration for mask post-processing operations.
- Matte
Handle - Builder for chaining mask processing operations on the raw matte.
- Outline
- Entry point for configuring and running background matting inference.
- Trace
Options vectorizer-vtracer - Configuration for vectorizing masks into SVG paths using VTracer.
- Vtracer
SvgVectorizer vectorizer-vtracer - Converts grayscale masks to SVG using the VTracer library.
Enums§
- Outline
Error - Error types that can occur during outline processing.
Constants§
- DEFAULT_
MODEL_ PATH - Default model path used when no explicit path is provided.
- ENV_
MODEL_ PATH - Environment variable name for specifying the model path.
Traits§
- Mask
Vectorizer - A trait representing an algorithm that can turn a mask into a vector representation.
Functions§
- trace_
to_ svg_ string vectorizer-vtracer - The helper function that uses VTracer to trace a grayscale mask to an SVG string.
Type Aliases§
- Outline
Result - Result type alias for operations that may fail with
OutlineError.