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

@giszhc/vips-thumbnail

v0.2.3

Published

基于 libvips 的图片压缩和缩略图命令行工具

Readme

vips-thumbnail

一个基于 libvips 的图片压缩和缩略图命令行工具,支持单图片和批量处理 JPG / PNG。

功能

  • 默认只压缩,不改变图片尺寸
  • 可按最长边生成缩略图
  • 支持单文件、目录和递归处理
  • 支持 macOS、Linux 和 Windows x64
  • 支持 npm 和 Homebrew 安装

npm 安装

需要 Node.js 18 或更高版本:

npm install --global @giszhc/vips-thumbnail
thumbnail --help

也可以不全局安装,直接运行:

npx @giszhc/vips-thumbnail --help

libvips 依赖

Windows x64 用户不需要手动安装。首次执行图片处理时,如果系统中没有 vips,工具会自动下载 libvips 8.18.4,校验 SHA-256 后安装到:

%LOCALAPPDATA%\vips-thumbnail\libvips\8.18.4

帮助命令不会触发下载。已有系统 vips 时会优先使用系统版本。

macOS 和 Linux 用户需要先安装 libvips:

# macOS
brew install vips

# Ubuntu / Debian
sudo apt update
sudo apt install -y libvips-tools

Homebrew 安装(macOS)

brew tap giszhc/vips-thumbnail
brew install thumbnail

使用方法

thumbnail <源路径> <输出路径> [参数]

只压缩图片,不改变尺寸:

thumbnail ./images ./out --quality 80

生成最长边为 400 像素的缩略图:

thumbnail ./images ./out --size 400 --quality 80

处理单张图片:

thumbnail ./photo.jpg ./out/photo.jpg --quality 80

递归处理目录:

thumbnail ./photos ./compressed --quality 75 --recursive

参数

| 参数 | 说明 | | --- | --- | | --quality <1-100> | JPG 压缩质量,默认 85 | | --size <数字> | 最长边尺寸,不传则保持原尺寸 | | --ext <.jpg\|.jpeg\|.png> | 指定输出格式 | | --recursive | 递归处理子目录 | | -h, --help | 显示帮助 |

发布

版本号与 Git tag 应保持一致。例如发布 0.2.3

npm test
npm pack --dry-run
git tag v0.2.3
git push origin v0.2.3

推送 v* tag 后,GitHub Actions 会发布 npm 包并更新 Homebrew Formula。仓库需要配置 NPM_TOKENHOMEBREW_TAP_TOKEN

License

MIT