← 返回
未分类

image-compression

Compress PNG images to reduce file size while maintaining visual quality. Use this skill whenever the user asks to compress images, reduce image file size, optimize PNG files, make images smaller, batch compress PNGs, or any request involving shrinking image file sizes. Trigger also when the user mentions images being "too large", "need to save space", or wants to "optimize" images for web/storage.
压缩 PNG 图片以减小文件体积,同时保持视觉质量。 当用户要求压缩图片、减小图片文件大小、优化 PNG 文件、让图片更小、批量压缩 PNG,或者任何涉及缩小图片文件大小的请求时,请使用此 skill。当用户提到图片"太大"、"需要节省空间"、或想要为网页/存储"优化"图片时也触发。
user_34ee2070
未分类 community v1.0.0 1 版本 100000 Key: 无需
★ 1
Stars
📥 74
下载
💾 0
安装
1
版本
#latest

概述

Image Compression Skill

Compress PNG images using Python/Pillow. Two modes:

  • Lossless — no quality loss, but moderate size reduction (typically 1-30%)
  • Lossy — reduces color count to 256, significant size reduction (typically 50-80%) with minimal visual difference

Supports both single file and batch (folder) processing.

When the user provides input

They may say things like:

  • "Compress this image" — ask if they want lossless or lossy
  • "Compress all PNGs in this folder" — batch process a directory
  • "Make this image smaller" — default to lossy for significant savings
  • Point to a file or folder path

If the user doesn't specify mode, ask: "lossless (keep quality) or lossy (much smaller)?"

Workflow

  1. Understand the scope: Single file or batch? Lossless or lossy?
  1. Lossless:
    • Save with optimize=True and compress_level=9
    • Best for screenshots with text/UI elements where sharpness matters
  1. Lossy:
    • Quantize to 256 colors using Image.Quantize.MEDIANCUT
    • Save with optimize=True
    • Best for photos, gradients, or any image where small file size is priority
  1. Report results: original size → compressed size → savings percentage

Script

A helper script compress_png.py handles both modes:

# Lossless (default)
python scripts/compress_png.py <path> [--output OUTPUT] [--overwrite]

# Lossy
python scripts/compress_png.py <path> [--output OUTPUT] [--overwrite] --lossy
  • : Path to a PNG file or a directory
  • --output: Output path (single file) or output directory (batch)
  • --overwrite: Overwrite original files
  • --lossy: Use lossy compression (256 colors)

Example interaction

User: "compress this image C:\Users\me\image.png it's too big"

You: "Lossless or lossy?"

User: "lossy"

You: Compress, report:

> Original: 1.2 MB → Lossy: 440 KB (saved 63%)

版本历史

共 1 个版本

  • v1.0.0 Initial release 当前
    2026-05-17 16:42 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

design-media

Video Frames

steipete
使用 ffmpeg 从视频中提取帧或短片。
★ 134 📥 52,884
design-media

Openai Whisper

steipete
使用 Whisper CLI 进行本地语音转文字(无需 API 密钥)
★ 331 📥 93,834
design-media

Nano Banana Pro

steipete
使用 Nano Banana Pro (Gemini 3 Pro Image) 生成或编辑图像。支持文生图、图生图及 1K/2K/4K 分辨率,适用于图像创建、修改及编辑请求,使用 --input-image 指定输入图像。
★ 430 📥 116,969