Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 9, 2024 via pnpm

sharp 0.32.6

High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images
Package summary
Share
2
issues
2
high severity
license
1
meta
1
6
licenses
36
MIT
9
Apache-2.0
6
ISC
3
other licenses
(MIT OR WTFPL)
1
BSD-3-Clause
1
(BSD-2-Clause OR MIT OR Apache-2.0)
1
Package created
20 Aug 2013
Version published
18 Sep 2023
Maintainers
1
Total deps
54
Direct deps
8
License
Apache-2.0

Issues

2

2 high severity issues

high
Recommendation: Validate that the license expression complies with your license policy
via: prebuild-install@7.1.2
via: sharp@0.32.6
Collapse
Expand

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
36 Packages, Including:
base64-js@1.5.1
bl@4.1.0
buffer@5.7.1
color-convert@2.0.1
color-name@1.1.4
color-string@1.9.1
color@4.2.3
decompress-response@6.0.0
deep-extend@0.6.0
end-of-stream@1.4.4
fast-fifo@1.3.2
fs-constants@1.0.0
github-from-package@0.0.0
is-arrayish@0.3.2
mimic-response@3.1.0
minimist@1.2.8
mkdirp-classic@0.5.3
napi-build-utils@1.0.2
node-abi@3.62.0
node-addon-api@6.1.0
prebuild-install@7.1.2
pump@3.0.0
queue-tick@1.0.1
readable-stream@3.6.2
safe-buffer@5.2.1
simple-concat@1.0.1
simple-get@4.0.1
simple-swizzle@0.2.2
streamx@2.16.1
string_decoder@1.3.0
strip-json-comments@2.0.1
tar-fs@2.1.1
tar-fs@3.0.6
tar-stream@2.2.0
tar-stream@3.1.7
util-deprecate@1.0.2

Apache License 2.0

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
use-patent-claims
place-warranty
Cannot
hold-liable
use-trademark
Must
include-copyright
include-license
state-changes
include-notice
9 Packages, Including:
b4a@1.6.6
bare-events@2.2.2
bare-fs@2.3.0
bare-os@2.3.0
bare-path@2.1.2
bare-stream@1.0.0
detect-libc@2.0.3
sharp@0.32.6
tunnel-agent@0.6.0

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
6 Packages, Including:
chownr@1.1.4
inherits@2.0.4
ini@1.3.8
once@1.4.0
semver@7.6.2
wrappy@1.0.2

(MIT OR WTFPL)

Permissive
1 Packages, Including:
expand-template@2.0.3

BSD 3-Clause "New" or "Revised" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
use-trademark
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
ieee754@1.2.1

(BSD-2-Clause OR MIT OR Apache-2.0)

Expression
1 Packages, Including:
rc@1.2.8
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

8
All Dependencies CSV
β“˜ This is a list of sharp 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
color4.2.35.64 kBMIT
prod
detect-libc2.0.323.07 kBApache-2.0
prod
node-addon-api6.1.058.23 kBMIT
prod
prebuild-install7.1.233.09 kBMIT
prod
1
semver7.6.293.19 kBISC
prod
simple-get4.0.15.4 kBMIT
prod
tar-fs3.0.616.48 kBMIT
prod
tunnel-agent0.6.05.69 kBApache-2.0
prod

Visualizations

Frequently Asked Questions

What does sharp do?

Sharp is a high-performance Node.js module used for image processing. It is the fastest tool to resize images, especially JPEG, PNG, WebP, GIF, AVIF, and TIFF formats. The typical use case is to convert large images to smaller, web-friendly ones with varying dimensions. Apart from resizing, it offers operations like rotation, extraction, compositing, and gamma correction. Sharp is faster than using quickest ImageMagick and GraphicsMagick settings due to its use of libvips.

How do you use sharp?

Sharp is easy to use with Node.js. First, install it using npm with the command npm install sharp. Once installed, require it in your JavaScript file like const sharp = require('sharp'). You can then use it to resize, rotate or change image setting.

Here are some usage examples: Callback method:

const sharp = require('sharp');
sharp(inputBuffer)
  .resize(320, 240)
  .toFile('output.webp', (err, info) => { ... });

Promise method:

const sharp = require('sharp');
sharp('input.jpg')
  .rotate()
  .resize(200)
  .jpeg({ mozjpeg: true })
  .toBuffer()
  .then( data => { ... })
  .catch( err => { ... });

Async/await method:

const sharp = require('sharp');
const semiTransparentRedPng = await sharp({
  create: {
    width: 48,
    height: 48,
    channels: 4,
    background: { r: 255, g: 0, b: 0, alpha: 0.5 }
  }
})
  .png()
  .toBuffer();

Stream method:

const sharp = require('sharp');
const roundedCorners = Buffer.from(
  '<svg><rect x="0" y="0" width="200" height="200" rx="50" ry="50"/></svg>'
);

const roundedCornerResizer =
  sharp()
    .resize(200, 200)
    .composite([{
      input: roundedCorners,
      blend: 'dest-in'
    }])
    .png();

readableStream
  .pipe(roundedCornerResizer)
  .pipe(writableStream);

Where are the sharp docs?

You can find the complete documentation for sharp at sharp.pixelplumbing.com. The documentation provides complete installation instructions, API documentation, benchmark tests, and a changelog.