Auto
CANVAS BACKGROUND
ENGINE
Transparency Showcase
Benchmarks of 9 distinct encoding strategies including temporal sequence manipulation.

Standard

Industry standard behavior. Optimal balance, but may discard RGB data in Alpha=0 pixels.

1.31 MB

Pixel Perfect

Ensures RGB integrity in Alpha=0 pixels. Critical for clean edges during scaling.

1.40 MB

Backward Sequence

Last frame first, first frame last. Reverses the entire temporal flow.

1.31 MB

Ping-Pong Loop

Forward then backward. Eliminates the "jump" artifact in infinite loops.

2.58 MB

Optimized Small

Intelligent mixed-mode strategy with 50% alpha quality reduction. Best for web.

203 KB

Near Lossless

Perceptual preprocessing that yielding significant bitstream compression.

895 KB

Extreme Slow

Maximum exhaustive search (M6) with best predictive spatial alpha filtering.

1.38 MB

Lossy Sharp

High-contrast preservation optimized via the Sharp YUV conversion pipeline.

209 KB

Lossy Low

Absolute footprint floor for bandwidth constraints. Noticeable artifacts.

125 KB
Technical Architecture Deep Dive

Modular Workspace & FFI Layer

The img2webp-rs architecture separates concerns into a decoupled multi-crate workspace:

  • webp_anim (Library): A safe Rust abstraction over libwebp-sys. It manages the full lifecycle of C-allocated muxer objects using Rust's RAII patterns and automated memory cleanup via the Drop trait.
  • img2webp (CLI Driver): A stateful command-line interface featuring a non-linear two-pass argument parser. This enables the ability to interleave frame-specific configurations (quality, duration) with sequence inputs.

Temporal Manipulation Engine

A primary enhancement in img2webp-rs is the Stateful Job Queue. Unlike standard C converters, we buffer the entire encoding plan, allowing flags like -reverse and -pingpong to manipulate the temporal sequence before the expensive encoding logic begins.

Advanced Alpha Filtering & Pipeline

Asset generation follows a rigid 4-stage deterministic pipeline:

  1. Safe Decoding: Imagery is decoded into raw RGBA8 buffers using audited Rust decoders (PNG, TIFF, BMP, etc.).
  2. Minimal Differencing: The WebPAnimEncoder calculates the optimal sub-rectangle delta between sequential frames to minimize bitstream weight.
  3. Pixel-Perfect Integrity: The -exact flag preserves raw RGB data at 0% Alpha, preventing the "Dark Halo" effect common in browser rendering.
  4. Remuxing Engine: Post-assembly metadata injection via WebPMux.
// img2webp-rs Internal Alpha Selection match config.alpha_filtering { 0 => "None: Direct bitstream storage", 1 => "Fast: Horizontal/Vertical heuristic prediction", 2 => "Best: Full spatial neighborhood analysis (M6)", }