{"id":18785,"library":"sharp-cli","title":"sharp-cli","description":"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.","status":"active","version":"5.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/vseventer/sharp-cli","tags":["javascript","cli","jpeg","libvips","png","sharp","vips","webp"],"install":[{"cmd":"npm install sharp-cli","lang":"bash","label":"npm"},{"cmd":"yarn add sharp-cli","lang":"bash","label":"yarn"},{"cmd":"pnpm add sharp-cli","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"sharp-cli wraps the sharp library; sharp must be installed","package":"sharp","optional":false},{"reason":"used for command-line argument parsing","package":"yargs","optional":false}],"imports":[{"note":"If sharp-cli is not globally installed, use npx or install globally first.","wrong":"sharp --help","symbol":"sharp command line","correct":"npx sharp --help"},{"note":"Use --resize with two arguments (width height), not two separate flags.","wrong":"sharp input.jpg --resize 300 --resize 200 output.jpg","symbol":"Resize an image","correct":"sharp input.jpg --resize 300 200 output.jpg"},{"note":"Since v4.0.0, composite accepts multiple image arguments directly.","wrong":"sharp input.jpg composite overlay1.png output.jpg composite overlay2.png output.jpg","symbol":"Composite with multiple images","correct":"sharp input.jpg composite overlay1.png overlay2.png output.jpg"}],"quickstart":{"code":"npx sharp-cli input.jpg resize 300 200 -o output.jpg\nnpx sharp-cli input.png --rotate 90 --format webp -o rotated.webp\nnpx sharp-cli input.tif --resize 800 600 --extract 50 50 200 200 output.png","lang":"javascript","description":"Resize an image to 300x200, rotate 90 degrees and convert to WebP, and extract a region from a TIFF."},"warnings":[{"fix":"Update Node.js to version 18.17 or later.","message":"Node.js version requirement increased to 18.17+ in v5.0.0","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Use --channel instead of --band.","message":"In v4.0.0, --band was renamed to --channel for extractChannel command","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Install globally with npm install -g sharp-cli or use npx sharp.","message":"If sharp-cli is not installed globally, commands must be prefixed with npx","severity":"gotcha","affected_versions":"*"},{"fix":"Upgrade Node.js to at least 14.15.","message":"v3.0.0 dropped support for Node.js < 14.15","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use --metadata instead of --withMetadata.","message":"--withMetadata input option renamed to --metadata in v4.1.0","severity":"deprecated","affected_versions":">=4.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Specify an input image file as the first argument, e.g., sharp input.jpg resize 300 200 output.jpg","cause":"No input file provided to sharp command","error":"Error: Input file is required"},{"fix":"Install globally: npm install -g sharp-cli, or use npx sharp","cause":"sharp-cli not installed globally or npx not used","error":"Command not found: sharp"},{"fix":"Use: sharp resize <width> <height>, e.g., sharp input.jpg resize 300 200 output.jpg","cause":"Incorrect argument syntax for resize command","error":"Error: Unknown argument: --resize 300"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}