Skip to content

SharpHigh Performance Node.js Image Processing Library

The fastest JPEG, PNG, WebP, AVIF and TIFF image manipulation module

Sharp

Why Choose Sharp?

Sharp is the fastest image processing library for Node.js, designed for modern web applications. It uses the libvips image processing library to provide excellent performance and memory efficiency.

Key Features

  • High Performance: 4-5 times faster than ImageMagick and GraphicsMagick
  • Low Memory Usage: Stream processing, supports large images
  • Automatic Format Conversion: Intelligent detection and conversion of image formats
  • Rich Operations: Resize, crop, rotate, filters and more
  • TypeScript Support: Complete type definitions
  • Active Maintenance: Continuous updates and improvements

Quick Examples

javascript
import sharp from 'sharp';

// Resize images
await sharp('input.jpg')
  .resize(300, 200)
  .toFile('output.jpg');

// Convert to WebP format
await sharp('input.png')
  .webp({ quality: 80 })
  .toFile('output.webp');

// Create thumbnails
await sharp('input.jpg')
  .resize(100, 100, { fit: 'cover' })
  .jpeg({ quality: 90 })
  .toFile('thumbnail.jpg');

Installation

bash
npm install sharp

Or using pnpm:

bash
pnpm add sharp

Getting Started

Check out the Quick Start Guide to learn how to start using Sharp, or browse the API Documentation for complete reference information.

Released under the Apache 2.0 License.