New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

imgkit

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imgkit

High-performance image processing for Bun and Node.js - resize, convert, compress with HEIC, WebP, AVIF, PNG, JPEG support

latest
Source
npmnpm
Version
2.2.1
Version published
Maintainers
1
Created
Source

imgkit

High-performance image processing for Bun and Node.js

Built with Rust and napi-rs for maximum speed

npm version downloads CI License

Documentation · API Reference · Examples · Changelog

Highlights

Performance

  • 950x faster metadata extraction
  • 1.9x faster thumbnail generation
  • 2.6x faster concurrent operations
  • SIMD-accelerated JPEG codec
  • Zero-copy cropping & buffer handling

Features

  • Fast Thumbnails (shrink-on-load)
  • Native HEIC/HEIF support
  • Smart Crop (content-aware)
  • Dominant Colors (UI theming)
  • ThumbHash & BlurHash placeholders
  • Perceptual Hashing (pHash/dHash)
  • ML Tensor Conversion (SIMD)
  • EXIF metadata read/write
  • Timeout & AbortSignal support

Installation

bun add imgkit       # Bun
npm install imgkit   # npm
yarn add imgkit      # Yarn
pnpm add imgkit      # pnpm

Quick Start

import { resize, metadata, smartCrop, transform, thumbhash, toTensor } from 'imgkit';

const buf = Buffer.from(await Bun.file('photo.jpg').arrayBuffer());

const info = await metadata(buf);                                    // Ultra-fast metadata
const resized = await resize(buf, { width: 200 });                   // Resize
const thumb = await smartCrop(buf, { aspectRatio: '1:1' });          // Content-aware crop
const { dataUrl } = await thumbhash(buf);                            // Placeholder image
const webp = await transform(buf, {                                  // Full pipeline
  crop: { aspectRatio: '16:9' }, resize: { width: 1280 },
  output: { format: 'webp', webp: { quality: 85 } }
});
const tensor = await toTensor(buf, {                                 // ML-ready tensor
  width: 224, height: 224, normalization: 'Imagenet', layout: 'Chw'
});

// Timeout & cancellation (all async functions)
const safe = await resize(buf, { width: 800 }, { timeoutMs: 5000 });
const ac = new AbortController();
await resize(buf, { width: 800 }, { signal: ac.signal });

API

FunctionDescriptionAsyncSync
metadata()Image dimensions, format, color info
resize()Resize with multiple algorithms
crop()Crop region (zero-copy)
smartCrop()Content-aware crop
dominantColors()Extract colors for UI theming
thumbnail()Fast thumbnail (shrink-on-load)
transform()Multi-operation pipeline
toJpeg() / toPng() / toWebp()Format conversion
blurhash() / thumbhash()Image placeholders
toTensor()ML tensor (SIMD-accelerated)
imageHash() / imageHashDistance()Perceptual hashing
writeExif() / stripExif()EXIF metadata

All async functions support { timeoutMs?, signal? } for timeout & cancellation. All have sync variants (resizeSync(), etc.).

Full API Reference Examples Timeout & Cancellation

Formats & Platforms

Formats: JPEG (TurboJPEG/SIMD), PNG, WebP, GIF, BMP, TIFF (read), HEIC/AVIF (macOS ARM64)

Platforms: macOS (ARM64, x64) · Linux (x64 glibc/musl, ARM64) · Windows (x64, ARM64)

Development

git clone https://github.com/nexus-aissam/imgkit.git && cd imgkit
bun install && bun run build && bun run build:ts && bun test

License

MIT © Aissam Irhir

Documentation npm GitHub Issues

Keywords

image

FAQs

Package last updated on 21 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts