Overview
sharp is a high-speed Node-API module leveraging the libvips image processing library. It excels at converting large images to smaller, web-friendly formats like JPEG, PNG, WebP, GIF, and AVIF. Designed for Node.js >= 18.17.0, Deno, and Bun, sharp is significantly faster than ImageMagick and GraphicsMagick, achieving 4x-5x speed improvements due to libvips' efficient processing. It correctly handles color spaces, embedded ICC profiles, and alpha transparency. Operations include resizing, rotation, extraction, compositing, and gamma correction. Input can be streams, Buffer objects, or filesystem paths, with support for splitting a single input stream into multiple processing pipelines. Deep Zoom image pyramids can also be generated. It optimizes JPEG and PNG file sizes using mozjpeg and pngquant respectively, and animated GIFs using custom methods, eliminating the need for separate command-line tools.
