npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

webp-maker

v1.1.2

Published

Convert images to WebP and build animated WebP via CLI or Node.js

Downloads

351

Readme

webp-maker

Convert PNG/JPG images to .webp and build animated .webp files from the command line or from Node.js.

Install

npm install webp-maker

Check the CLI:

npx webp-maker --help

Quick Start

Convert images to .webp:

webp-maker cwebp --from ./origin --to ./webp --quality 90 --concurrency 4

Build an animated .webp from converted frames:

webp-maker awebp --from ./webp --to ./awebp/ani.webp --fps 10

Run the full flow in one command:

webp-maker pipeline \
  --from ./origin \
  --webp-dir ./webp \
  --to ./awebp/ani.webp \
  --quality 90 \
  --concurrency 4 \
  --fps 10 \
  --json

CLI

The CLI is non-interactive and uses explicit long option names only, which makes it easy to call from scripts, CI, and AI agents.

For cwebp, the default concurrency is chosen automatically from available CPU cores and capped at 8.

Commands

cwebp

Convert a single file or a directory of png, jpg, jpeg files to .webp.

webp-maker cwebp --from ./origin --to ./webp --quality 90 --concurrency 4

| Option | Required | Default | Description | |------|----------|---------|-------------| | --from | yes | | source file or directory | | --to | yes | | output directory | | --quality | no | 75 | output quality from 0 to 100 | | --concurrency | no | auto | number of parallel conversions, capped automatically | | --config | no | | JSON config file | | --json | no | false | print machine-readable JSON |

awebp

Create an animated .webp from a directory of .webp frames.

webp-maker awebp --from ./webp --to ./awebp/ani.webp --fps 10 --repeat 0

| Option | Required | Default | Description | |------|----------|---------|-------------| | --from | yes | | source .webp directory | | --to | yes | | output animated .webp file | | --fps | no | 30 | frames per second | | --repeat | no | 0 | animation loop count | | --config | no | | JSON config file | | --json | no | false | print machine-readable JSON |

pipeline

Run cwebp first and then awebp in one command.

webp-maker pipeline --from ./origin --webp-dir ./webp --to ./awebp/ani.webp --quality 90 --concurrency 4 --fps 10 --json

| Option | Required | Default | Description | |------|----------|---------|-------------| | --from | yes | | source file or directory | | --webp-dir | yes | | intermediate .webp directory | | --to | yes | | output animated .webp file | | --quality | no | 75 | output quality for cwebp | | --concurrency | no | auto | number of parallel conversions for cwebp | | --fps | no | 30 | frames per second for awebp | | --repeat | no | 0 | animation loop count | | --config | no | | JSON config file | | --json | no | false | print machine-readable JSON |

Config File

CLI flags override values from the config file.

{
  "from": "./origin",
  "webpDir": "./webp",
  "to": "./awebp/ani.webp",
  "quality": 90,
  "concurrency": 4,
  "fps": 10,
  "repeat": 0
}

Example file in this repository:

examples/ai-pipeline.config.json

webp-maker pipeline --config ./webp-maker.json --json
webp-maker pipeline --config ./examples/ai-pipeline.config.json --json

JSON Output

When --json is enabled, the CLI prints structured output and uses exit code 0 on success, 1 on failure.

Success example:

{
  "ok": true,
  "command": "cwebp",
  "result": {
    "command": "cwebp",
    "from": "./origin",
    "to": "./webp",
    "quality": 90,
    "concurrency": 4,
    "count": 6,
    "files": [
      {
        "from": "./origin/1.png",
        "to": "./webp/1.webp"
      }
    ]
  }
}

Error example:

{
  "ok": false,
  "error": "..."
}

Library

const {cwebp, awebp} = require('webp-maker');

async function run() {
  const converted = await cwebp({
    from: './origin',
    to: './webp',
    quality: 90,
    concurrency: 4
  });

  const animated = await awebp({
    from: './webp',
    to: './awebp/ani.webp',
    fps: 10,
    repeat: 0
  });

  console.log(converted.count, animated.to);
}

run();

cwebp(config)

| Field | Type | Default | Description | |------|------|---------|-------------| | from | string | | source file or directory | | to | string | | output directory | | quality | number | 75 | output quality | | concurrency | number | auto | number of parallel conversions | | log | boolean | true | print progress logs |

Returns a Promise that resolves to a conversion summary object.

awebp(config)

| Field | Type | Default | Description | |------|------|---------|-------------| | from | string | | source .webp directory | | to | string | | output animated .webp file | | fps | number | 30 | frames per second | | repeat | number | 0 | animation loop count | | log | boolean | true | print progress logs |

Returns a Promise that resolves to an animation summary object.

Development

Run the test suite:

npm test

The smoke test generates tiny temporary images at runtime, so the repository does not need to keep binary test fixtures.