sharp
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images
Node.js image processing was historically slow and memory-hungry โ libraries used ImageMagick via child processes, paying the cost of spawning a new process for every image. Sharp wraps libvips, a C library that processes images in a streaming pipeline, using far less memory and running much faster.
Sharp is a transformation pipeline for images. You chain operations: sharp(input).resize(800, 600).webp({ quality: 80 }).toFile(output). The pipeline is lazy โ nothing runs until you call a finaliser like .toFile() or .toBuffer(). libvips processes the image in a streaming pass rather than loading it fully into memory.
Install sharp
npm install sharp
import { } from 'sharp';Use it when
Use Sharp for image resizing, format conversion (JPEG to WebP/AVIF), thumbnail generation, watermarking, and metadata extraction in Node.js. It's the standard choice for image processing in server-side Next.js, image CDN backends, and upload pipelines.
Skip it when
Sharp is a native module โ it requires native binaries and can complicate deployment in serverless environments. For Cloudflare Workers or edge functions, use the Cloudflare Images API or Vercel's built-in image optimisation instead.
Ready to explore the full API?
See every class, function, and relationship in an interactive graph.