Token导航 LogoToken导航TokenDH.com
图像处理操作浏览器github未标认证来源可访问许可证需确认审计异常

image-compress-skill图像压缩技巧

Agent Skill

用于辅助图像生成、图片编辑、视觉素材处理或图像模型工作流。它适合让 Agent 根据文本生成图片、处理背景、整理视觉提示词或调用相关图像工具。使用时需要确认输入图片、版权来源、输出格式和模型限制;涉及人物、品牌、商品或公开展示素材时,应额外核对授权、真实性和内容合规边界。

总安装

1,069

周安装

45

GitHub Stars

3

下载量

374
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:image-compress-skill(图像压缩技巧)
来源仓库:https://github.com/994ak/image-compress-skill
仓库路径:skills/image-compress-skill
安装命令:
npx skills add https://github.com/994ak/image-compress-skill --skill image-compress-skill
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/994ak/image-compress-skill --skill image-compress-skill

简介

image-compress-skill 用于辅助图像生成、编辑和视觉素材处理。

  • 适合根据文本生成图片或调用图像模型工具。
  • 使用时需确认输入图片、版权来源和输出格式。
  • 涉及人物或品牌素材时,应额外核对授权和合规边界。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

ImageCompressSkill

The intelligent image optimization engine for AI Agents. Smart routing between PNG quantization and WebP compression.

1. Smart Strategy Overview

The optimal compression strategy depends on the input content type and the target use case.

Content TypePrimary StrategyToolchainTarget Format
PhotographsLossy WebPimage -> libwebp.webp
Graphics / Logos / UIOptimized PNGimage -> imagequant -> oxipng.png
Universal (Web)WebP (High Compat)image -> libwebp.webp
Universal (Archive)Optimized PNGimage -> oxipng (Lossless).png

Decision Logic:

  1. Try WebP First (Default): For most web use cases, WebP offers the best size/quality ratio (30-90% reduction).
  2. Fallback to PNG: If the input is a simple graphic (low color count) OR if WebP results in a larger file (rare, but happens with simple shapes), use the Quantized PNG pipeline.
  3. Strict Quality: If the user demands "Lossless" or "No visual change", skip quantization and use only oxipng (PNG) or Lossless WebP.

Setup

This skill requires the image-compress-tool binary.

If the tool is not found, the agent should run:

./scripts/install.sh

Usage

1. Smart Compression (Auto)

Best for: Photos, complex gradients, web assets.

  • Quality (-q):

- 80-85: Sweet spot for web (visually indistinguishable). Default. - 75: Aggressive, might show slight artifacts on sharp edges. - 90+: Archival quality, diminishing returns.

  • Method (-m):

- 4: Default. Good balance. - 6: Slowest but best compression. Use for static assets (build time).

  • Usage: // Rust (using webp crate) let encoder = webp::Encoder::from_image(&img)?; let memory = encoder.encode(80.0); // Q=80

B. Optimized PNG (via imagequant + oxipng)

Best for: Logos, icons, screenshots, line art, transparent assets.

  • Step 1: Quantization (imagequant)

- Quality: min=0, max=80 (or 80-90 for high fidelity). - Speed: 4 (Default). 1 (Slowest/Best). - *Note*: This step converts 32-bit RGBA to 8-bit Indexed Color. It is "lossy" but visually excellent for graphics.

  • Step 2: Optimization (oxipng)

- Level (-o): - 2: Default. Good balance. - 4: Recommended for production builds (slower but worth it). - 6: Max. Very slow. - Strip (--strip safe): Remove metadata. - Interlace (-i 0): Disable interlacing (saves ~20%).

  • Usage: // Pipeline let (palette, pixels) = imagequant_attributes.quantize(img)?; // Step 1 let png_data = encode_png(palette, pixels); let optimized = oxipng::optimize_from_memory(&png_data, &options)?; // Step 2

3. Implementation Rules for Agents

When implementing image compression tools:

  1. Dual Mode Support: Always implement BOTH pipelines (WebP and PNG).
  2. Smart Defaults:

- Default Quality: 80 (for both WebP and ImageQuant). - Default WebP Method: 4. - Default Oxipng Level: 2 (or 4 if speed isn't critical).

  1. Output Logic:

- If user asks for "compress this image" -> Output WebP (smallest). - If user asks for "optimize this PNG" -> Output Quantized PNG. - If input is small (< 10KB) simple shape -> Check if WebP > PNG, if so, prefer PNG.

4. Code Resources

Dependency Setup

[dependencies]
image = "0.25"
imagequant = "4.4"
oxipng = "10.1"
webp = "0.3"
anyhow = "1.0"
clap = { version = "4.5", features = ["derive"] }

Rust Implementation Snippet (The "Golden Path")

See image-compress-tool/src/main.rs in the current project for the reference implementation that handles:

  1. CLI Argument Parsing
  2. Image Loading
  3. WebP Branch (using webp crate)
  4. PNG Branch (using imagequant -> png encoding -> oxipng)

5. Verification

Always verify:

  1. File Size: Is output < input?
  2. Format: Is it a valid WebP/PNG?
  3. Visual: Open in browser/viewer.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.56%
按下载量换算140

Claude

30.12%
按下载量换算113

Cursor

17.25%
按下载量换算65

Gemini CLI

8.91%
按下载量换算33

安全审计

Gen Agent Trust Hub

未通过

Socket

可疑

Snyk

可疑

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills