optimage-cli

0.1.6 • Public • Published

Optimage

Installation

npm install -D optimage-cli

Usage

npx optimage-cli "{path}" "{ignore}" [--config=path/to/config.json]

Argument

Argument Description Example
path A Glob pattern that match all files to optimize. `"images/**/*.@(png
ignore A Glob pattern that match files to ignore. "images/raw/*"

Options

Option Description Example
--config Relative or absolute path the a JSON config file. optimage.json

Example usage

node optimage "images/**/*.@(png|jpg|jpeg|gif|webp)" "images/raw/**/*" --config=optimage.json

Optimize all png and jpeg image files in ./images exept those in the ./images/raw folder using configuration from optimage.json.

Configuration

Entry Description
cache Sharp cache configuration
options Sharp images options (applied to all formats)
jpeg Sharp jpeg options
png Sharp png options
webp Sharp webp options
gif Sharp gif options

Example configuration

optimage.json:

{
  "cache": {
    "memory":  500
  },
  "options": {
    "quality": 80
  },
  "png": {
    "compressionLevel": 9
  },
  "webp": {
    "reductionEffort": 6
  },
  "jpeg": {
    "quality": 75
  }
}

Dependents (0)

Package Sidebar

Install

npm i optimage-cli

Weekly Downloads

1

Version

0.1.6

License

MIT

Unpacked Size

7.56 kB

Total Files

4

Last publish

Collaborators

  • tom32i