📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP

sharp

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
s

sharp

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

0.34.1
latest
92

Supply Chain Security

100

Vulnerability

100

Quality

90

Maintenance

100

License

Install scripts

Supply chain risk

Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.

Found 1 instance in 1 package

Version published
Weekly downloads
12M
2.79%
Maintainers
1
Weekly downloads
 
Created
Issues
115

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

FAQs

Package last updated on 07 Apr 2025

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