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

picture-tiny-cli

v0.1.1

Published

Compress images to a target file size and/or pixel dimensions with minimal quality loss — JPEG/PNG/WebP/AVIF, pure-JSON output for agents. Requires the bun runtime.

Downloads

279

Readme

picture-tiny-cli (ptiny)

在 agent 中可靠调用的图片压缩 CLI:压到目标文件体积和/或像素尺寸,最小程度影响画质,stdout 始终输出纯 JSON。

运行时要求:bun。 ptiny 以 bun 执行 TypeScript 源码(依赖原生 sharp)。请先安装 bun

安装 / 使用

# 免安装直接用(推荐)
bunx picture-tiny-cli photo.jpg --max-size 500kb

# 或全局安装后用 ptiny(PATH 上需有 bun)
bun add -g picture-tiny-cli      # 或 npm i -g picture-tiny-cli
ptiny photo.jpg --max-size 500kb

用法

# 压到 500KB 以内,保留原格式
ptiny photo.jpg --max-size 500kb

# 限制最长边 1600px 并转 webp,输出到目录
ptiny ./imgs/*.png --max-side 1600 --format webp --out-dir ./out

# 同时限定体积与尺寸
ptiny photo.jpg --max-size 300kb --max-side 1920

从源码运行:bun installbun bin/ptiny …

选项

bun bin/ptiny --help

输出(JSON)

{
  "ok": true,
  "summary": { "count": 1, "ok": 1, "failed": 0, "savedPercent": 64.0 },
  "results": [
    { "input": "photo.jpg", "output": "photo.min.jpg", "ok": true,
      "outputBytes": 180000, "quality": 78, "reachedTarget": true, "warnings": [] }
  ],
  "errors": []
}

退出码:全成功 0,部分失败 1,用法错误 2

库用法

import { compressImage } from "picture-tiny-cli";
const out = await compressImage(buffer, { maxSize: 200 * 1024, maxSide: 1600 });