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, imgkit 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 | imgkit | 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 |
| Source Size | Target | imgkit | sharp | Speedup |
|---|---|---|---|---|
| 800x600 | 200px | 3.1ms | 4.3ms | 1.40x |
| 1600x1200 | 200px | 6.4ms | 8.0ms | 1.24x |
| 2000x1500 | 200px | 8.6ms | 10.1ms | 1.18x |
| 3000x2000 | 200px | 14.7ms | 16.1ms | 1.10x |
| 4000x3000 | 400px | 32.4ms | 33.1ms | 1.02x |
Shrink-on-load optimization using libwebp's native scaling - faster than sharp across ALL sizes!
imgkit 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 imgkitimport { metadata, resize, crop, transform, thumbhash, toTensor } from 'imgkit';
// 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}`);
// Crop to aspect ratio (zero-copy, ultra-fast)
const squared = await crop(buffer, { aspectRatio: "1:1" });
// Resize with shrink-on-decode optimization
const thumbnail = await resize(buffer, { width: 200 });
// Full transform pipeline with crop + resize
const result = await transform(buffer, {
crop: { aspectRatio: "16:9" },
resize: { width: 1280 },
sharpen: 5,
output: { format: 'WebP', webp: { quality: 85 } }
});
// Generate thumbhash placeholder (better than blurhash)
const { dataUrl } = await thumbhash(buffer);
// Use directly: <img src={dataUrl} />
// ML tensor conversion (first JS package with native SIMD!)
const tensor = await toTensor(buffer, {
width: 224, height: 224,
normalization: 'Imagenet',
layout: 'Chw', batch: true
});
// Shape: [1, 3, 224, 224] - Ready for PyTorch/ONNX!| 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.