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 🙏

© 2025 – Pkg Stats / Ryan Hefner

img2webp-cli

v1.0.4

Published

Convert images to WebP format using WASM in cli

Readme

img2webp-cli

用于将当前目录下所有图像转换为 WebP 格式的命令行工具,带有递归处理子目录与压缩质量选择的功能,使用 WASM 进行处理。 English 中文

安装

npm:

npm install -g img2webp-cli

yarn:

yarn global add img2webp-cli

使用

  • 快捷使用:

在图片目录下执行:

cp2webp
  • 自定义使用:
cp2webp -i <input_directory> -o <output_directory> -q <quality> -r <recursive> -a <alpha>

命令行选项

  • -i, --input <path>: 指定输入目录,默认为当前目录 ./
  • -o, --output <path>: 指定输出目录,默认为 ./output
  • -q, --quality <number>: 指定压缩质量,范围为 1-100,默认为 60
  • -r, --recursive <number>: 是否递归处理子目录,默认为 0(不递归)
  • -a, --alpha <number>: 是否保留透明通道,1 表示保留,0 表示不保留,默认为 1
  • -h, --help: 显示帮助信息

示例

/path/to/input 目录中的图像转换为 WebP 格式,并将结果输出到 /path/to/output 目录:

  1. 进入图片目录
cd /path/to/input
  1. 执行命令
cp2webp

or

任意目录下执行

cp2webp -i /path/to/input -o /path/to/output -q 60 -r 1 -a 1

注意事项

  • 该工具支持的图像格式包括 JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC 等常见图片格式(具体支持格式请查看stb_image)
  • 默认情况下,输出目录会在指定的输出路径下创建一个名为 output 的子目录。
  • 递归处理的最大深度限制为 5 层,避免递归过深,出现意外。

感谢

许可证

MIT