Repolode
lovell

lovell/sharp

High-performance Node.js image processing module that resizes and converts JPEG, PNG, WebP, AVIF and TIFF images using libvips.

Open-source alternative to:ImageMagick

Stars
32,826
Forks
1,450
Open issues
121
Last commit
yesterday

What is it?

sharp is a Node-API module for processing images in Node.js. Its typical use is converting large images in common formats into smaller, web-friendly JPEG, PNG, WebP, GIF and AVIF files of different dimensions. It is built on the libvips library, which the project credits for resizing being several times faster than the quickest ImageMagick and GraphicsMagick settings.

Beyond resizing, sharp supports rotation, extraction, compositing and gamma correction. Colour spaces, embedded ICC profiles and alpha transparency are handled, and Lanczos resampling is used for resampling quality. Operations can be chained on a buffer, a file or a stream.

The module runs on any JavaScript runtime that supports Node-API v9, including Node.js 20.9.0 and later, Deno and Bun. Most modern macOS, Windows and Linux systems need no extra installation or runtime dependencies.

Key features

  • 01Resizes and converts JPEG, PNG, WebP, GIF and AVIF images.
  • 02Supports rotation, cropping, compositing and gamma correction.
  • 03Handles ICC profiles, EXIF orientation and alpha transparency.
  • 04Works with Buffers, files and streams.
  • 05Runs on Node.js, Deno and Bun via Node-API v9.

Use cases

  • Generating web-friendly thumbnails and multiple image sizes on upload.
  • Batch converting large photos to WebP or AVIF in a build or media pipeline.
  • Creating rounded corners, watermarks or overlays with SVG composites in a server.

Quick start

  1. 1

    Install sharp from npm

    npm install sharp
  2. 2

    Import or require sharp in your code

  3. 3

    Resize an image and write it to a WebP file

Things to know

  • Requires Node-API v9 support, such as Node.js 20.9.0 or newer.

In collections

Topics

#image-processing#nodejs#image-resize#libvips#webp#avif#jpeg#png#crop#exif

FAQ

What is sharp?
High-performance Node.js image processing module that resizes and converts JPEG, PNG, WebP, AVIF and TIFF images using libvips. sharp is a Node-API module for processing images in Node.js. Its typical use is converting large images in common formats into smaller, web-friendly JPEG, PNG, WebP, GIF and AVIF files of different dimensions. It is built on the libvips library, which the project credits for resizing being several times faster than the quickest ImageMagick and GraphicsMagick settings.
Is sharp free to use? What license does it have?
sharp is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is sharp still maintained?
Actively maintained. The last commit to sharp was on Nov 5, 2026.
What can I use sharp for?
Generating web-friendly thumbnails and multiple image sizes on upload. Batch converting large photos to WebP or AVIF in a build or media pipeline. Creating rounded corners, watermarks or overlays with SVG composites in a server.
How do I install sharp?
Install sharp from npm: npm install sharp Import or require sharp in your code Resize an image and write it to a WebP file
Where can I get sharp?
The source code and installation instructions are on GitHub: https://github.com/lovell/sharp

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects