https://github.com/cijiugechu/napi-image-cli
An efficient cli tool that helps you compress and convert images, powered by @napi-rs/image
https://github.com/cijiugechu/napi-image-cli
avif cli compression converter image napi-rs
Last synced: 12 months ago
JSON representation
An efficient cli tool that helps you compress and convert images, powered by @napi-rs/image
- Host: GitHub
- URL: https://github.com/cijiugechu/napi-image-cli
- Owner: cijiugechu
- License: mit
- Created: 2023-01-05T08:51:48.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-16T18:16:11.000Z (over 1 year ago)
- Last Synced: 2025-06-20T17:12:45.654Z (12 months ago)
- Topics: avif, cli, compression, converter, image, napi-rs
- Language: TypeScript
- Homepage:
- Size: 1.09 MB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# napi-image-cli
An efficient cli tool that helps you compress and convert images, powered by [@napi-rs/image](https://github.com/Brooooooklyn/Image).
see [example](./packages/playground/)
## Installation
```shell
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:
```json
//...
{
"image": "napi-image assets --type lossy --quality 75 --mode modern"
}
//...
```
and run:
```shell
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](https://github.com/cijiugechu)