Registry / data / sharp-cli

sharp-cli

JSON →
library5.2.0jsnpmunverified

sharp-cli is a command-line interface for the sharp library, a high-performance Node.js image processing module that uses libvips. Version 5.2.0 supports conversion and manipulation of JPEG, PNG, WebP, AVIF, TIFF, GIF, and SVG images. It provides commands for resizing, cropping, rotating, blurring, compositing, and other common image operations. The CLI mirrors most sharp API features, including input options like auto-orient and output options like smart-deblock. It follows sharp's release cadence and requires Node.js >= 18.17. Compared to alternatives like ImageMagick or GraphicsMagick, sharp-cli leverages libvips for speed and memory efficiency, with a focused, modern command set.

npm install sharp-cli
INSTALL
IMPORT
SIG · SHARP-CLI
S
sharp-cli
datajavascriptv5.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sharp command line
npx sharp --help
sharp --help
If sharp-cli is not globally installed, use npx or install globally first.
Resize an image
sharp input.jpg --resize 300 200 output.jpg
sharp input.jpg --resize 300 --resize 200 output.jpg
Use --resize with two arguments (width height), not two separate flags.
Composite with multiple images
sharp input.jpg composite overlay1.png overlay2.png output.jpg
sharp input.jpg composite overlay1.png output.jpg composite overlay2.png output.jpg
Since v4.0.0, composite accepts multiple image arguments directly.

Resize an image to 300x200, rotate 90 degrees and convert to WebP, and extract a region from a TIFF.

npx sharp-cli input.jpg resize 300 200 -o output.jpg npx sharp-cli input.png --rotate 90 --format webp -o rotated.webp npx sharp-cli input.tif --resize 800 600 --extract 50 50 200 200 output.png
sharp-cli --version
Debug
Known issues
breakingNode.js version requirement increased to 18.17+ in v5.0.0
fix
Update Node.js to version 18.17 or later.
affects: >=5.0.0
breakingIn v4.0.0, --band was renamed to --channel for extractChannel command
fix
Use --channel instead of --band.
affects: >=4.0.0
gotchaIf sharp-cli is not installed globally, commands must be prefixed with npx
fix
Install globally with npm install -g sharp-cli or use npx sharp.
affects: *
breakingv3.0.0 dropped support for Node.js < 14.15
fix
Upgrade Node.js to at least 14.15.
affects: >=3.0.0
deprecated--withMetadata input option renamed to --metadata in v4.1.0
fix
Use --metadata instead of --withMetadata.
affects: >=4.1.0
Errors
Common errors & fixes
Error: Input file is required
No input file provided to sharp command
fix
Specify an input image file as the first argument, e.g., sharp input.jpg resize 300 200 output.jpg
Command not found: sharp
sharp-cli not installed globally or npx not used
fix
Install globally: npm install -g sharp-cli, or use npx sharp
Error: Unknown argument: --resize 300
Incorrect argument syntax for resize command
fix
Use: sharp resize <width> <height>, e.g., sharp input.jpg resize 300 200 output.jpg
Upgrade
Version history
5.2.0latest on npm
Audit
Dependencies
sharprequiredsharp-cli wraps the sharp library; sharp must be installed
yargsrequiredused for command-line argument parsing
Agent activity
11 hits · last 30 days
node
8
Bingbot
1
OpenAI (training)
1
Resources
sharp-cli — npm install sharp-cli · libregistry