PixelBench is a demo app for the rn-image-compressor TurboModule, focused on repeatable image compression benchmarks and UI performance reporting.
A reusable high-performance React Native TurboModule (
rn-image-compressor) paired with a visual benchmarking tool (PixelBench) to evaluate, compare, and optimize image compression strategies on real devices.
- ๐ Executive Summary
- ๐งฉ System Overview
- ๐ Architecture & Pipeline
- โ๏ธ Technical Deep Dive
- ๐ Benchmarking & Metrics
- ๐งช Demo & Visuals
- ๐ Developer Setup
- ๐ง Design Decisions
- ๐ What Makes This Unique
- ๐ฎ Future Enhancements
- ๐ License
See PixelBench in action across its two core flows: benchmarking image compression and real-world single/batch compression.
Mobile applications increasingly depend on image-heavy workflowsโdocument capture, uploads, OCR pipelines, and media sharing. However, image compression is often:
- Slow (JS-bound processing)
- Inconsistent across platforms
- Hard to measure and optimize
PixelBench addresses this through a two-part system:
- High-performance native compression engine
- Designed as a drop-in library for any React Native app
- Built on JSI for near-zero bridge overhead
-
Visual interface to compare compression strategies
-
Enables developers to optimize for their specific use case
- Latency (speed)
- Storage savings
- Compression ratio
- Throughput
๐ Together, this forms a developer-facing performance toolkit, not just an implementation.
โฌ๏ธ Back to top
RNImageCompressor (Reusable Native Module)
+
PixelBench (Benchmark + Visualization App)
=
Full Performance Evaluation Platform
- Library โ Use
RNImageCompressorin production apps - Tool โ Use PixelBench to decide how to use it
Image Input (Camera / Gallery)
โ
Preprocessing (optional resize, normalization)
โ
RNImageCompressor (TurboModule - Native Layer)
โ
Compression Execution (JPEG/WebP)
โ
Metrics Collection
โ
PixelBench Aggregation Layer
โ
UI Visualization + JSON Export
Mobile
- React Native 0.74+
- TypeScript
- Ignite CLI
Native Layer
- iOS: Swift / Objective-C++
- Android: Kotlin / C++
- JSI bindings
Designed as a production-ready, reusable TurboModule:
- Compress images with adjustable quality
- Support for multiple formats (JPEG, WebP)
- Batch processing support
- Deterministic output
- Access to platform-optimized encoders
- Avoid JS thread bottlenecks
- Utilize hardware acceleration where available
Traditional bridge:
- JSON serialization overhead
- Async bottlenecks
TurboModules:
- Direct native calls
- Lower latency
- Higher throughput
๐ Critical for high-frequency operations like image processing
PixelBench is a developer-facing decision tool, not just a demo.
- Compression time (latency)
- Output size reduction
- Compression ratio
- Throughput
- Failure rates
What compression quality gives me the best tradeoff between speed and file size for my app? How much will the UI stressor/animations affect the compression speeds Which compression might be better for cetain plaforms, devices, or situations.
PixelBench is visual playground for testing.
{
"originalSizeKB": 4200,
"compressedSizeKB": 820,
"compressionRatio": 0.195,
"durationMs": 47,
"quality": 0.7
}- Optimize uploads dynamically
- Reduce backend costs
- Improve UX (faster interactions)
- Tune pipelines for OCR/ML workloads
โฌ๏ธ Back to top
git clone <repo>
cd pixelbench
pnpm installpnpm ios
pnpm androidDownload APK from the latest Release
import { compressImage } from "react-native-image-compressor"
const result = await compressImage(uri, {
quality: 0.7,
format: "jpeg",
})- Open the PixelBench screen.
- Pick 10 images.
- Preset:
social, Concurrency:2, Repeat runs:5, Stress:ON. - Run benchmark.
- Copy Markdown โPixelBench Resultsโ.
Benchmark windows include baseline (3s before), during (iteration), and recovery (3s after).
- iOS: run a Release scheme (or use your Ignite/Expo release build flow) and disable remote debugging.
- Android: run a release variant (e.g.,
assembleRelease+ install) or your release build flow. - Debug builds can distort timings; always compare like-for-like release runs.
Results are generated from the in-app exporter and pasted here.
Results example will be added soon!
โฌ๏ธ Back to top
- Keeps core module lightweight and reusable
- Enables experimentation without polluting production code
- Performance varies by device
- Simulators are misleading
- Provides ground-truth metrics
- Compression is a tradeoff problem
- Developers need visibility, not guesses
- Reusable TurboModule library + benchmarking platform
- Real-world performance testing (not synthetic)
- Developer-centric tooling
- Cross-platform native optimization
- Data-driven compression tuning
โฌ๏ธ Back to top
- Adaptive compression (network-aware)
- GPU acceleration
- Integration with Optical Character Recognition and Optical Object Detection pipelines
MIT License โ feel free to use and adapt.
โฌ๏ธ Back to top