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-cliVerified import paths — ran on the pinned version, not inferred.
Resize an image to 300x200, rotate 90 degrees and convert to WebP, and extract a region from a TIFF.
Update Node.js to version 18.17 or later.
Use --channel instead of --band.
Install globally with npm install -g sharp-cli or use npx sharp.
Upgrade Node.js to at least 14.15.
Use --metadata instead of --withMetadata.
Specify an input image file as the first argument, e.g., sharp input.jpg resize 300 200 output.jpg
Install globally: npm install -g sharp-cli, or use npx sharp
Use: sharp resize <width> <height>, e.g., sharp input.jpg resize 300 200 output.jpg