tpt-wasmforge
RustBrowser-native image processing and PDF generation in pure Rust + WebAssembly. Resize images, add watermarks, and generate PDFs entirely on the client's device — no server, no cloud costs. Dual-licensed MIT OR Apache-2.0.
0 stars0 forks0 watchers
Languages
Rust100.0%
README
tpt-wasmforge
Process images and generate PDFs in the browser. Save thousands in cloud costs.
A blazing-fast, browser-native document and media processing engine written in pure Rust with a minimal dependency philosophy. All processing happens on the client's device — no server, no cloud costs, no data ever leaves the browser.
Why tpt-wasmforge?
| ImageMagick | Pillow | jsPDF | tpt-wasmforge | |
|---|---|---|---|---|
| Runs in browser | ❌ | ❌ | ✅ | ✅ |
| Written in Rust | ❌ | ❌ | ❌ | ✅ |
| Minimal deps | ❌ | ❌ | ✅ | ✅ |
| Zero cloud cost | ❌ | ❌ | ✅ | ✅ |
| < 3 MB gzipped | ❌ | ❌ | ✅ | ✅ |
Quick Start (Browser / WASM)
npm install tpt-wasmforge
import { WasmForge } from 'tpt-wasmforge';
const forge = await WasmForge.init();
// Resize an image
const file = document.getElementById('file-input').files[0];
const image = await forge.loadImage(file);
const resized = image.resize(800, 600);
const blob = await resized.toBlob('image/jpeg', 0.9);
// Generate a PDF
const pdf = forge.createPdf();
pdf.addPage(595, 842); // A4
pdf.addText('Invoice #12345', { x: 50, y: 750, fontSize: 24 });
const pdfBlob = await pdf.toBlob();
Quick Start (Python)
pip install tpt-wasmforge
from tpt_wasmforge import WasmForge
forge = WasmForge()
image = forge.load_image("input.png")
image.resize(800, 600).save("output.jpg", quality=90)
Features
- Image processing — resize (bilinear), crop, rotate, format conversion (PNG ↔ JPEG), watermarking
- PDF generation — text, images, multi-page, Flate compression
- Browser-native — WebAssembly, no server required, works offline
- Tiny binary — < 10 MB uncompressed, < 3 MB gzipped
- Fast — Rust + WASM, < 50 ms to resize a 4K image
- Privacy-first — images never leave the user's device
Performance Targets
| Metric | Target |
|---|---|
| WASM binary (uncompressed) | < 10 MB |
| WASM binary (gzipped) | < 3 MB |
| Startup time | < 100 ms |
| Resize 4K → 800×600 | < 50 ms |
| PDF generation (10 pages) | < 200 ms |
| Memory (4K image) | < 50 MB |
Architecture
tpt-wasmforge/
├── tpt-media-core/ # Core types: ImageBuffer, ForgeError
├── tpt-media-image/ # PNG/JPEG I/O + image transforms
├── tpt-media-pdf/ # Minimal PDF writer (write-only)
├── tpt-media-ffi/ # C ABI for native integration
├── tpt-media-wasm/ # wasm-bindgen browser wrapper → npm
└── tpt-media-py/ # PyO3 Python wrapper → PyPI
License
Dual-licensed under MIT or Apache-2.0, at your option.
Copyright 2026 TPT Solutions.
All dependencies are audited via cargo-deny. Zero copyleft licenses in the transitive dependency tree.