Skip to content

Latest commit

 

History

History
39 lines (31 loc) · 1.21 KB

README.md

File metadata and controls

39 lines (31 loc) · 1.21 KB

napi-image-cli

An efficient cli tool that helps you compress and convert images, powered by @napi-rs/image.

see example

Installation

npm install napi-image-cli --save-dev
# or you use pnpm 
pnpm add napi-image-cli -D

Usage

in your package.json, add following code to scripts field:

//...
{
    "image": "napi-image assets --type lossy --quality 75 --mode modern"
}
//...

and run:

npm run image

Options

flag default description
--type [type] lossless specify type, lossy or lossless
--quality [quality] 75 specify quality, ranges from 0 to 100 and controls the loss and quality during compression
--mode [mode] lazy specify mode, compat mode means compatibility with browsers that don't support avif, i.e. transforming avif to jpg ; modern mode will transform all the formats to avif; lazy mode will do nothing about format transforming.
--outDir [outDir] dist/assets specify Specify the output directory (relative to project root).

License

MIT © nemurubaka