# sharp

> High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library

- Type: agent or tool
- Field: Image & Design
- Repository: https://github.com/lovell/sharp
- GitHub stars: 32883
- Licence: Apache-2.0
- Language: JavaScript
- Last push: 2026-11-30
- Page: https://imutechz.in/agents/sharp

## What it is
Sharp is a high-performance Node.js image processing module that uses libvips to resize and convert JPEG, PNG, WebP, AVIF, and TIFF images. It works with Node.js 20.9+, Deno, and Bun via Node-API v9. Resizing is typically 4-5x faster than ImageMagick while preserving color spaces, ICC profiles, and alpha transparency with Lanczos resampling. It also supports rotation, extraction, compositing, and gamma correction.

## Features
- Resize and convert JPEG, PNG, WebP, AVIF, TIFF, GIF
- 4-5x faster than ImageMagick via libvips
- Handles color spaces, ICC profiles, alpha transparency
- Supports rotation, extraction, compositing, gamma correction
- Works with Node.js, Deno, Bun (Node-API v9)
- Stream-based processing with pipe support

## Best for
- Web image optimization and resizing
- Batch image format conversion
- Real-time image transformation pipelines
- Generating responsive image variants

## Pros
- No additional runtime dependencies on most modern OS
- Correct color space and ICC profile handling
- Lanczos resampling maintains quality at speed
- Supports streaming and buffer-based workflows

## Cons
- Requires Node.js = 20.9.0 or compatible runtime
- Native libvips compilation may need build tools on some platforms
- Limited to image formats supported by libvips

## Install
```
npm install sharp
```

## Usage
```
const output = await sharp('input.jpg')
  .autoOrient()
  .resize({ width: 200 })
  .jpeg({ mozjpeg: true })
  .toBuffer();
```

Tags: image-processing, image-resize, libvips, nodejs, webp, avif, jpeg, png
