sharp is a Node-API module for resizing and transforming JPEG, PNG, WebP, AVIF, TIFF, GIF, and SVG images. It uses libvips and runs on Node.js, Deno, and Bun.
Overview
sharp targets server-side and tooling workflows that need to turn large photos and graphics into smaller web-friendly output at varied dimensions. Typical jobs include format conversion, resizing, rotation, cropping, compositing, and gamma correction while preserving color spaces, embedded ICC profiles, and alpha channels.
The module binds to libvips rather than shelling out to generic command-line imagers, which the authors cite as a major speed advantage for resize operations compared with common ImageMagick or GraphicsMagick setups. Lanczos resampling is used when scaling. Output can be written to files, buffers, or streams, and a single input stream can fan out to multiple pipelines.
Supported input formats include JPEG, PNG, WebP, GIF, AVIF, TIFF, and SVG. Output may be those formats plus raw pixel data. Deep Zoom image pyramids can be generated for tile viewers such as OpenSeadragon. Optional encoder integrations help shrink JPEG and PNG file sizes without separate optimizer processes.
On many current macOS, Windows, and Linux systems the package installs without extra native dependencies beyond the published binaries. Documentation and benchmarks are published on the project site for installation, API usage, and performance characteristics.
Key features
- Resize and convert common raster formats
- libvips-backed processing pipeline
- Stream, buffer, and filesystem I/O
- Rotation, extract, composite, gamma ops
- ICC profile and alpha handling
- Deep Zoom pyramid generation
- Runs on Node.js, Deno, and Bun
- Built-in JPEG and PNG size optimizations
Use cases
- Generating responsive web image variants
- Batch resizing uploads in Node services
- Building image CDN or thumbnail workers
- Producing tile pyramids for map viewers
- Pipeline transforms inside JavaScript tooling