SmallPict LogoSmallPict
Official Integration & SDK

Async Zero-Allocation Image Optimization Pipeline for Rust

Integrate SmallPict inside high-throughput backend services written in Actix-Web, Axum, or Tokio. Process and upload media buffers with maximum memory efficiency.

Install:cargo add smallpict-rs
RUST Package

Implementation Example

rust
use smallpict_rs::{SmallPictClient, OptimizeOptions, ImageFormat};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = SmallPictClient::new("sp_live_secret_key_xxxxx")?;
    
    let image_bytes = tokio::fs::read("input.jpg").await?;
    let optimized = client.optimize(&image_bytes, OptimizeOptions {
        format: ImageFormat::Avif,
        quality: 80,
        max_width: Some(1920),
        strip_metadata: true,
    }).await?;
    
    tokio::fs::write("output.avif", optimized.bytes).await?;
    println!("Savings: {}% ({}ms)", optimized.savings_percentage, optimized.duration_ms);
    Ok(())
}

Integration Steps

11. Add Dependency

Add smallpict-rs to your Cargo.toml file.

22. Initialize Client

Instantiate SmallPictClient with your API Key or environment variable.

33. Optimize Byte Stream

Stream raw image bytes and receive compressed AVIF/WebP buffers asynchronously.

Key Benefits

  • Async non-blocking I/O powered by Tokio & Reqwest
  • Zero memory leaks & thread-safe client design
  • Direct stream buffer processing without local disk writes
  • Sub-40ms execution time
Official Developer Documentation

Need Complete Implementation Guides & API Specs?

Explore parameter references, authentication mechanisms, error codes, and local testing instructions in our official Rust Crate developer guide.

Read Rust Crate Docs

Supercharge Your Rust Crate Image Pipeline

Experience sub-50ms AVIF and WebP image optimization in your application. Zero setup fee, instant sandbox keys, and unlimited scalability.