TurboJPEG with SIMD
Uses libjpeg-turbo with SSE2/AVX2/NEON acceleration for 2-6x faster JPEG encoding and decoding than pure Rust implementations.
Learn more
Native Rust library for Bun and Node.js. Up to 950x faster than alternatives.
Built from the ground up for maximum performance, bun-image-turbo uses native Rust with carefully optimized codepaths for each operation.
| Component | Technology | Benefit |
|---|---|---|
| JPEG Codec | TurboJPEG (libjpeg-turbo) | SIMD acceleration (SSE2/AVX2/NEON) |
| Resize Engine | fast_image_resize + Rayon | Multi-threaded with adaptive algorithms |
| WebP Codec | libwebp bindings | Google's optimized encoder/decoder |
| HEIC Decoder | libheif-rs | Native Apple format support |
| Node Bindings | napi-rs | Zero-copy buffer handling |
Tested on Apple M1 Pro with Bun 1.3.3:
| Operation | bun-image-turbo | sharp | Speedup |
|---|---|---|---|
| WebP Metadata | 0.004ms | 3.4ms | 950x |
| JPEG Metadata | 0.003ms | 0.1ms | 38x |
| 50 Concurrent Ops | 62ms | 160ms | 2.6x |
| Transform Pipeline | 12.2ms | 19.1ms | 1.6x |
| 1MB JPEG → 800px | 12.6ms | 20.3ms | 1.6x |
| Thumbnail (200px) | 8.8ms | 10.7ms | 1.2x |
bun-image-turbo is the only high-performance image library with native HEIC support:
| Operation | Time | Notes |
|---|---|---|
| HEIC Metadata | 0.1ms | Header-only parsing |
| HEIC → JPEG | 169ms | Full quality conversion |
| HEIC → 800px | 138ms | Shrink-on-decode optimization |
| HEIC → Thumbnail | 137ms | Fast 200px generation |
Note: sharp does NOT support HEIC/HEIF files!
bun add bun-image-turboimport { metadata, resize, transform, blurhash } from 'bun-image-turbo';
// Read image
const buffer = Buffer.from(await Bun.file('photo.jpg').arrayBuffer());
// Get metadata (header-only, ultra-fast)
const info = await metadata(buffer);
console.log(`${info.width}x${info.height} ${info.format}`);
// Resize with shrink-on-decode optimization
const thumbnail = await resize(buffer, { width: 200 });
// Full transform pipeline
const result = await transform(buffer, {
resize: { width: 800, height: 600, fit: 'cover' },
rotate: 90,
sharpen: 10,
output: { format: 'webp', webp: { quality: 85 } }
});
// Generate blurhash placeholder
const { hash } = await blurhash(buffer, 4, 3);| Format | Read | Write | Notes |
|---|---|---|---|
| JPEG | ✅ | ✅ | TurboJPEG with SIMD |
| PNG | ✅ | ✅ | Adaptive compression |
| WebP | ✅ | ✅ | Lossy & lossless |
| HEIC/HEIF | ✅ | ❌ | macOS ARM64 only |
| AVIF | ✅ | ❌ | Via libheif |
| GIF | ✅ | ✅ | Animated support |
| BMP | ✅ | ✅ | Full support |
Prebuilt binaries are available for all major platforms:
| Platform | Architecture | Supported | HEIC |
|---|---|---|---|
| macOS | ARM64 (M1/M2/M3/M4/M5) | ✅ | ✅ |
| macOS | x64 (Intel) | ✅ | ❌ |
| Linux | x64 (glibc) | ✅ | ❌ |
| Linux | x64 (musl/Alpine) | ✅ | ❌ |
| Linux | ARM64 (glibc) | ✅ | ❌ |
| Windows | x64 | ✅ | ❌ |
| Windows | ARM64 | ✅ | ❌ |
Note: HEIC/HEIF decoding is only available on macOS ARM64. All other image formats (JPEG, PNG, WebP, GIF, BMP, TIFF) work on all platforms.