Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 17, 2024 via pnpm

sharp 0.33.2

High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images
Package summary
Share
12
issues
2
high severity
license
1
meta
1
10
moderate severity
license
10
7
licenses
10
Apache-2.0
8
LGPL-3.0-or-later
7
MIT
5
other licenses
Apache-2.0 AND LGPL-3.0-or-later
2
Apache-2.0 AND LGPL-3.0-or-later AND MIT
1
ISC
1
0BSD
1
Package created
20 Aug 2013
Version published
12 Jan 2024
Maintainers
1
Total deps
30
Direct deps
22
License
Apache-2.0

Issues

12

2 high severity issues

high
Recommendation: Validate that the license expression complies with your license policy
via: @img/sharp-wasm32@0.33.2
via: sharp@0.33.2
Collapse
Expand

10 moderate severity issues

moderate
Recommendation: Validate that the package complies with your license policy
via: @img/sharp-darwin-arm64@0.33.2 & others
Recommendation: Validate that the package complies with your license policy
via: @img/sharp-darwin-x64@0.33.2 & others
Recommendation: Validate that the package complies with your license policy
via: @img/sharp-libvips-linux-arm64@1.0.1 & others
Recommendation: Validate that the package complies with your license policy
via: @img/sharp-libvips-linux-arm@1.0.1 & others
Recommendation: Validate that the package complies with your license policy
via: @img/sharp-libvips-linux-s390x@1.0.1 & others
Recommendation: Validate that the package complies with your license policy
via: @img/sharp-libvips-linux-x64@1.0.1 & others
Recommendation: Validate that the package complies with your license policy
via: @img/sharp-libvips-linuxmusl-arm64@1.0.1 & others
Recommendation: Validate that the package complies with your license policy
via: @img/sharp-libvips-linuxmusl-x64@1.0.1 & others
Recommendation: Validate that the package complies with your license policy
via: @img/sharp-win32-ia32@0.33.2
Recommendation: Validate that the package complies with your license policy
via: @img/sharp-win32-x64@0.33.2
Collapse
Expand

Licenses

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
10 Packages, Including:
@img/sharp-darwin-arm64@0.33.2
@img/sharp-darwin-x64@0.33.2
@img/sharp-linux-arm64@0.33.2
@img/sharp-linux-arm@0.33.2
@img/sharp-linux-s390x@0.33.2
@img/sharp-linux-x64@0.33.2
@img/sharp-linuxmusl-arm64@0.33.2
@img/sharp-linuxmusl-x64@0.33.2
detect-libc@2.0.3
sharp@0.33.2

GNU Lesser General Public License v3.0 or later

Weakly Protective
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
use-patent-claims
Cannot
sublicense
hold-liable
Must
include-original
state-changes
disclose-source
include-license
include-copyright
include-install-instructions
8 Packages, Including:
@img/sharp-libvips-darwin-arm64@1.0.1
@img/sharp-libvips-darwin-x64@1.0.1
@img/sharp-libvips-linux-arm64@1.0.1
@img/sharp-libvips-linux-arm@1.0.1
@img/sharp-libvips-linux-s390x@1.0.1
@img/sharp-libvips-linux-x64@1.0.1
@img/sharp-libvips-linuxmusl-arm64@1.0.1
@img/sharp-libvips-linuxmusl-x64@1.0.1

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
7 Packages, Including:
@emnapi/runtime@0.45.0
color-convert@2.0.1
color-name@1.1.4
color-string@1.9.1
color@4.2.3
is-arrayish@0.3.2
simple-swizzle@0.2.2

Apache-2.0 AND LGPL-3.0-or-later

Weakly Protective
2 Packages, Including:
@img/sharp-win32-ia32@0.33.2
@img/sharp-win32-x64@0.33.2

Apache-2.0 AND LGPL-3.0-or-later AND MIT

Expression
1 Packages, Including:
@img/sharp-wasm32@0.33.2

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
1 Packages, Including:
semver@7.6.2

BSD Zero Clause 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
include-copyright
include-license
include-original
Cannot
hold-liable
Must
1 Packages, Including:
tslib@2.6.2
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

22
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
@img/sharp-darwin-arm640.33.297.91 kBApache-2.0
prod optional
1
@img/sharp-darwin-x640.33.2102.5 kBApache-2.0
prod optional
1
@img/sharp-libvips-darwin-arm641.0.16.69 MBLGPL-3.0-or-later
prod optional
1
@img/sharp-libvips-darwin-x641.0.17.51 MBLGPL-3.0-or-later
prod optional
1
@img/sharp-libvips-linux-arm641.0.16.74 MBLGPL-3.0-or-later
prod optional
1
@img/sharp-libvips-linux-arm1.0.15.91 MBLGPL-3.0-or-later
prod optional
1
@img/sharp-libvips-linux-s390x1.0.16.09 MBLGPL-3.0-or-later
prod optional
1
@img/sharp-libvips-linux-x641.0.16.72 MBLGPL-3.0-or-later
prod optional
1
@img/sharp-libvips-linuxmusl-arm641.0.16.76 MBLGPL-3.0-or-later
prod optional
1
@img/sharp-libvips-linuxmusl-x641.0.16.85 MBLGPL-3.0-or-later
prod optional
1
@img/sharp-linux-arm640.33.2102.45 kBApache-2.0
prod optional
1
@img/sharp-linux-arm0.33.298.29 kBApache-2.0
prod optional
1
@img/sharp-linux-s390x0.33.2110.23 kBApache-2.0
prod optional
1
@img/sharp-linux-x640.33.2110.28 kBApache-2.0
prod optional
1
@img/sharp-linuxmusl-arm640.33.2107.29 kBApache-2.0
prod optional
1
@img/sharp-linuxmusl-x640.33.2113.97 kBApache-2.0
prod optional
1
@img/sharp-wasm320.33.23.45 MBApache-2.0 AND LGPL-3.0-or-later AND MIT
prod optional
1
@img/sharp-win32-ia320.33.27.71 MBApache-2.0 AND LGPL-3.0-or-later
prod optional
1
@img/sharp-win32-x640.33.27.77 MBApache-2.0 AND LGPL-3.0-or-later
prod optional
1
color4.2.35.64 kBMIT
prod
detect-libc2.0.323.07 kBApache-2.0
prod
semver7.6.293.19 kBISC
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.