sharp is a free, open source photo & video editors project written in JavaScript and released under Apache-2.0. It has 32,692 GitHub stars, 1,436 forks and 123 open issues, and was last pushed 5 days ago. On this registry it ranks #3 of 22 tracked projects in Photo & Video Editors, with 5 head-to-head comparisons available.

What is sharp?

sharp is a high-performance Node.js image processing library that converts large images in common formats into smaller, web-friendly JPEG, PNG, WebP, GIF and AVIF files, and it is built for JavaScript developers who need fast, dependency-light resizing inside Node.js, Deno or Bun applications.

What it is

sharp is a Node-API module, written in JavaScript and backed by the libvips library, that performs image resizing and manipulation in-process rather than by shelling out to an external command-line tool. libvips gives it the speed and memory profile, while the Node-API layer exposes it through idiomatic JavaScript, with both ESM (import sharp from 'sharp') and CommonJS (const sharp = require('sharp')) entry points. It runs on every JavaScript runtime that supports Node-API v9, including Node.js (>= 20.9.0), Deno and Bun, and it is released under the Apache License, Version 2.0.

The concrete problem it solves is large-scale image conversion without the cost of spawning external binaries. The typical use case is turning large source images into smaller, web-friendly JPEG, PNG, WebP, GIF and AVIF images at varying dimensions, and the README states that resizing an image is typically 4x-5x faster than using the quickest ImageMagick and GraphicsMagick settings. It replaces the pattern of piping files through ImageMagick or GraphicsMagick from a JavaScript server, keeping the work inside the runtime.

Key capabilities

  • Resizing to explicit dimensions with Lanczos resampling, as in .resize({ width: 320, height: 240 }), so quality is not sacrificed for speed.
  • Output encoding to web-friendly JPEG, PNG, WebP, GIF and AVIF, written either to a path with .toFile('output.webp') or held in memory with .toBuffer().
  • Encoder control such as .jpeg({ mozjpeg: true }) for tuning the JPEG output.
  • Orientation and colour handling through .autoOrient(), correct treatment of colour spaces, embedded ICC profiles and alpha transparency channels, and the exif, icc, crop and avif topic areas.
  • Compositing and geometric operations, including .composite([{ input: roundedCorners, blend: 'dest-in' }]), rotation, extraction and gamma correction.
  • Synthetic image creation via sharp({ create: { width: 48, height: 48, channels: 4, background: { r: 255, g: 0, b: 0, alpha: 0.5 } } }).
  • Stream piping, where a readable stream flows through a reusable sharp() resizer into a writable stream.

Who uses it and how

  • Backend teams running image upload and thumbnail generation inside a Node.js service, where each request resizes a buffer and returns a smaller WebP or AVIF.
  • Applications deployed on Deno or Bun that rely on the Node-API v9 compatibility layer rather than Node.js itself.
  • Streaming pipelines that process image data as it arrives, using .pipe() chains instead of buffering an entire file.
  • Projects migrating away from ImageMagick and GraphicsMagick subprocess calls, where the appeal is the 4x-5x resize advantage and the absence of an external process per image.
  • Pipelines that must preserve embedded ICC profiles, colour spaces and alpha channels for photographs rather than treating images as opaque bytes.

Getting started

Install with npm install sharp, then import it as import sharp from 'sharp' under ESM or require it as const sharp = require('sharp') under CommonJS. Full installation instructions, API documentation, benchmark tests and the changelog live at sharp.pixelplumbing.com.

How it compares

The README benchmarks sharp against ImageMagick and GraphicsMagick, the two command-line tools it most directly supplants, and claims a typical 4x-5x speed advantage over their quickest settings while keeping Lanczos resampling quality. Unlike those tools, sharp is a library loaded into a JavaScript runtime rather than a separate executable invoked per image, and it is licensed under Apache-2.0 with source available at github.com/lovell/sharp. Most modern macOS, Windows and Linux systems need no additional install or runtime dependencies beyond the package itself.

When to use it — and when not to

sharp is a library, not a service: it needs no database, object storage or mail server, so the operational burden is limited to the runtime and the libvips library it binds to, and there is nothing to host or monitor on its behalf. It is the wrong choice when the stack is not JavaScript, when the runtime cannot provide Node-API v9, or when Node.js is older than 20.9.0, because those environments fall outside the documented support. Weigh the 123 open issues and the fact that no hosted or managed option is offered in the facts: teams wanting a turnkey image service rather than an embedded module should look elsewhere.

project readme (upstream, from github) — read inline

sharp

sharp logo

The typical use case for this high speed Node-API module is to convert large images in common formats to smaller, web-friendly JPEG, PNG, WebP, GIF and AVIF images of varying dimensions.

It can be used with all JavaScript runtimes that provide support for Node-API v9, including Node.js (>= 20.9.0), Deno and Bun.

Resizing an image is typically 4x-5x faster than using the quickest ImageMagick and GraphicsMagick settings due to its use of libvips.

Colour spaces, embedded ICC profiles and alpha transparency channels are all handled correctly. Lanczos resampling ensures quality is not sacrificed for speed.

As well as image resizing, operations such as rotation, extraction, compositing and gamma correction are available.

Most modern macOS, Windows and Linux systems do not require any additional install or runtime dependencies.

Documentation

Visit sharp.pixelplumbing.com for complete installation instructions, API documentation, benchmark tests and changelog.

Examples

npm install sharp
// ESM
import sharp from 'sharp';

// CJS
const sharp = require('sharp');
await sharp(inputBuffer)
  .resize({ width: 320, height: 240 })
  .toFile('output.webp', (err, info) => { ... });
const output = await sharp('input.jpg')
  .autoOrient()
  .resize({ width: 200 })
  .jpeg({ mozjpeg: true })
  .toBuffer();
const semiTransparentRedPng = await sharp({
  create: {
    width: 48,
    height: 48,
    channels: 4,
    background: { r: 255, g: 0, b: 0, alpha: 0.5 }
  }
})
  .png()
  .toBuffer();
const roundedCorners = Buffer.from(
  '<svg><rect x="0" y="0" width="200" height="200" rx="50" ry="50"/></svg>'
);

const roundedCornerResizer =
  sharp()
    .resize(200, 200)
    .composite([{
      input: roundedCorners,
      blend: 'dest-in'
    }])
    .png();

readableStream
  .pipe(roundedCornerResizer)
  .pipe(writableStream);

Contributing

A guide for contributors covers reporting bugs, requesting features and submitting code changes.

Licensing

Copyright 2013 Lovell Fuller and others.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Frequently asked questions

Is sharp free to use?

sharp is open source under the Apache-2.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does sharp do?

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

What is sharp written in?

sharp is primarily written in JavaScript. Its source is publicly available at https://github.com/lovell/sharp, and it has 32,692 GitHub stars.