Scripts2026年7月14日·1 分钟阅读

Squoosh — Browser-Based Image Compression by Google

Squoosh is an open-source web app from Google Chrome Labs that compresses images using codecs like MozJPEG, AVIF, WebP, and OxiPNG directly in the browser with no server uploads required.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Squoosh Image Compression
直接安装命令
npx -y tokrepo@latest install b35e42b3-7f1b-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

Squoosh is a web application and CLI tool built by Google Chrome Labs that lets developers compress and convert images using modern codecs. It runs entirely in the browser via WebAssembly, so no image data ever leaves your machine. The CLI version brings the same codec power to build pipelines and automation scripts.

What Squoosh Does

  • Compresses images using MozJPEG, WebP, AVIF, OxiPNG, and other codecs in-browser via WASM
  • Provides a side-by-side visual comparison of original vs compressed output
  • Supports resize, reduce palette, and quantization controls per codec
  • Offers a Node.js CLI for batch processing in CI/CD pipelines
  • Outputs optimized images with no server round-trip or cloud dependency

Architecture Overview

Squoosh compiles each image codec (libjpeg, libwebp, libavif, oxipng) to WebAssembly so it runs at near-native speed inside the browser. The web app is a Preact-based PWA that uses Web Workers to keep the UI responsive during heavy encoding. The CLI wraps the same WASM modules in a Node.js process for headless batch use.

Self-Hosting & Configuration

  • Clone the repo and run npm install && npm run build to produce a static site
  • Serve the build/ directory behind any web server (Nginx, Caddy, S3)
  • No database or backend required; all processing happens client-side
  • The CLI is configured entirely via command-line flags per codec
  • Docker is not needed; a simple static file host is sufficient

Key Features

  • Zero data upload — all encoding runs locally in WebAssembly
  • Supports next-gen formats (AVIF, WebP, JPEG XL) alongside legacy JPEG/PNG
  • Real-time visual diff with a draggable slider for quality comparison
  • Works offline as a Progressive Web App after first load
  • CLI enables integration into GitHub Actions, Webpack, or custom pipelines

Comparison with Similar Tools

  • ImageOptim — macOS-only native app; Squoosh is cross-platform and browser-based
  • Sharp — Node.js library for server-side processing; Squoosh runs client-side via WASM
  • TinyPNG — cloud service with upload limits; Squoosh is fully local and unlimited
  • Imgproxy — server-side proxy for on-the-fly resizing; Squoosh is a standalone optimizer
  • Caesium — desktop GUI compressor; Squoosh adds a web UI plus CLI for automation

FAQ

Q: Does Squoosh upload my images to a server? A: No. All compression happens locally in your browser using WebAssembly. No data leaves your machine.

Q: Can I use Squoosh in a CI pipeline? A: Yes. The @squoosh/cli npm package lets you batch-compress images in any Node.js environment.

Q: Which codec should I choose for web delivery? A: AVIF offers the best compression ratio for photos, with WebP as a widely supported fallback. Use OxiPNG for graphics with transparency.

Q: Is the project still maintained? A: The web app remains functional. The CLI package is in maintenance mode; for heavy automation consider Sharp or libvips.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产