Socket
Socket
Sign inDemoInstall

sharp

Package Overview
Dependencies
Maintainers
1
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sharp

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


Version published
Weekly downloads
6.5M
increased by5.8%
Maintainers
1
Weekly downloads
 
Created

What is sharp?

The sharp npm package is a high-performance Node.js module for resizing, converting, and manipulating images. It is built around the libvips image processing library, which allows it to handle large images and perform operations quickly and with a low memory footprint.

What are sharp's main functionalities?

Image Resizing

Resizes an image to the specified width and height.

sharp('input.jpg').resize(300, 200).toFile('output.jpg', (err, info) => {});

Format Conversion

Converts an image from one format to another, such as JPEG to PNG.

sharp('input.jpg').toFormat('png').toBuffer().then(data => {});

Image Rotation

Rotates an image by a specified degree.

sharp('input.jpg').rotate(90).toBuffer().then(data => {});

Extracting Image Regions

Extracts a region of the image starting at the left and top offsets and with the specified width and height.

sharp('input.jpg').extract({ left: 100, top: 100, width: 300, height: 200 }).toFile('output.jpg', (err, info) => {});

Image Overlay

Overlays an image on top of another using composition.

sharp('input.jpg').composite([{ input: 'overlay.png', gravity: 'southeast' }]).toFile('output.jpg', (err, info) => {});

Adjusting Image Quality

Adjusts the quality of an image, useful for optimizing the file size.

sharp('input.jpg').jpeg({ quality: 80 }).toBuffer().then(data => {});

Other packages similar to sharp

Keywords

FAQs

Package last updated on 16 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc