lovell/sharp
This is an external open-source GitHub repository imported into the WOCSOL Marketplace for discovery. The original repository owner is the primary creator.
Repository Details
Repository Description
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
# sharp <picture><img src="https://sharp.pixelplumbing.com/sharp-logo.svg" width="160" height="160" alt="sharp logo" align="right"></picture> 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](https://github.com/libvips/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](https://sharp.pixelplumbing.com/) for complete [installation instructions](https://sharp.pixelplumbing.com/install), [API documentation](https://sharp.pixelplumbing.com/api-constructor), [benchmark tests](https://sharp.pixelplumbing.com/performance) and [changelog](https://sharp.pixelplumbing.com/changelog). ## Examples ```sh npm install sharp ``` ```javascript // ESM import sharp from 'sharp'; // CJS const sharp = require('sharp'); ``` ```javascript await sharp(inputBuffer) .resize({ width: 320, height: 240 }) .toFile('output.webp', (err, info) => { ... }); ``` ```javascript const output = await sharp('input.jpg') .autoOrient() .resize({ width: 200 }) .jpeg({ mozjpeg: true }) .toBuffer(); ``` ```javascript const semiTransparent
Related Repositories
Product Discussion
Ask questions or discuss this product. New comments are reviewed before publishing.
Loading comments...