PluginBench
Skill
Pass
Audit score 90

screenshot-compression

zc277584121/marketing-skills

Compress PNG and JPEG screenshots in place using pngquant and jpegoptim while preserving format compatibility.

What is screenshot-compression?

Reduces screenshot file sizes by quantizing PNGs to 256-color palettes and re-encoding JPEGs at configurable quality levels. Use this when preparing images for documentation, repositories, or web publishing where format compatibility matters more than maximum compression.

  • Compresses PNG files 60-80% using pngquant color quantization with Floyd-Steinberg dithering
  • Compresses JPEG files 20-50% using jpegoptim with metadata stripping and Huffman optimization
  • Processes files in place, overwriting originals with compressed versions
  • Supports batch processing of single files or entire directories with optional recursion
  • Provides per-file and total compression summaries after processing
  • Maintains original PNG/JPEG format for maximum compatibility across platforms and tools

How to install screenshot-compression

npx skills add https://github.com/zc277584121/marketing-skills --skill screenshot-compression
Prerequisites
  • pngquant must be installed (brew install pngquant on macOS, sudo apt install pngquant on Ubuntu/Debian)
  • jpegoptim must be installed (brew install jpegoptim on macOS, sudo apt install jpegoptim on Ubuntu/Debian)
Claude Code
Cursor
Windsurf
Cline

How to use screenshot-compression

  1. 1.Run the compression script with file or directory paths: python /path/to/skills/screenshot-compression/scripts/compress_screenshots.py <files-or-directories>
  2. 2.The script checks for pngquant and jpegoptim; if missing, it prints install instructions and exits
  3. 3.Optionally add --recursive flag to process subdirectories, or --png-quality and --jpeg-quality flags to adjust compression levels
  4. 4.Review the per-file compression summary printed after processing to verify results
  5. 5.Back up original files first if needed, as compression overwrites files in place

Use cases

Good for
  • Reducing image sizes in GitHub READMEs and documentation before committing
  • Batch compressing screenshot directories for blog posts or technical articles
  • Preparing UI screenshots for Word, PowerPoint, or platforms with limited WebP support
  • Optimizing images for WeChat editors and forums that don't support modern formats
  • Tuning compression quality for code screenshots that require sharp text readability
Who it's for
  • Documentation writers and technical authors
  • DevOps and infrastructure engineers managing repositories
  • Content creators preparing images for multiple platforms
  • Developers optimizing repository size and CI/CD artifact storage

screenshot-compression FAQ

Why not convert to WebP for better compression?

WebP has superior compression but lacks support in WeChat editors, Microsoft Office, and some blog platforms. Keeping PNG/JPEG ensures compatibility everywhere while still achieving 20-80% size reduction.

Can I undo compression if the quality is too low?

No — files are overwritten in place. Always back up originals before running compression, or test quality settings on a copy first.

What quality settings should I use for code screenshots?

Use --png-quality 90-100 for PNGs and --jpeg-quality 90 for JPEGs to preserve sharp text. General screenshots work well at 80-95 and 85 respectively.

Does the script install pngquant and jpegoptim automatically?

No. The script checks for their presence and prints platform-specific install instructions if either is missing. You must install them manually.

Which file formats are supported?

Only .png, .jpg, and .jpeg files are processed. Other formats are silently skipped.

Full instructions (SKILL.md)

Source of truth, from zc277584121/marketing-skills.


name: screenshot-compression description: Compress PNG and JPEG screenshots in place using pngquant and jpegoptim, keeping the original format for maximum compatibility.

Skill: Screenshot Compression

Compress screenshot images (PNG/JPEG) in place while keeping the original format. Uses pngquant for PNG and jpegoptim for JPEG — both are highly effective for screenshot content (UI elements, text, flat colors).

Prerequisites: pngquant and jpegoptim must be installed on the system. The script will not install them automatically — it checks for their presence and prints install instructions if missing.


When to Use

The user has screenshot files that are too large and wants to reduce file size without changing format. Common scenarios:

  • Preparing images for GitHub READMEs, blog posts, or documentation
  • Reducing image sizes before committing to a repository
  • Batch compressing a directory of screenshots

Why Keep Original Format (Not WebP)

WebP has better compression, but poor compatibility in some contexts:

ContextWebP Support
Browsers (Chrome/Firefox/Safari/Edge)Yes
GitHub Issues/PRsYes
WeChat editorNo
Word / PowerPointNo
Some forums/blog backendsVaries

Keeping PNG/JPEG ensures the compressed images work everywhere.


Default Workflow

python /path/to/skills/screenshot-compression/scripts/compress_screenshots.py <files-or-directories>

The script will:

  1. Check that pngquant and jpegoptim are installed — if not, print install instructions and exit
  2. Auto-detect file format by extension
  3. Compress each file in place (overwrites the original)
  4. Print per-file and total compression summary

Dependency Check

The script requires two system tools. If either is missing, it exits with install instructions instead of proceeding. Do not install them on behalf of the user — just relay the error message so the user can install them.

Install commands:

# macOS
brew install pngquant jpegoptim

# Ubuntu / Debian
sudo apt install pngquant jpegoptim

# CentOS / RHEL
sudo yum install pngquant jpegoptim

Script Options

FlagDefaultDescription
paths (positional)requiredImage files or directories to compress
-r, --recursiveoffRecursively process directories
--png-quality80-95pngquant quality range (min-max, 0-100)
--jpeg-quality85jpegoptim max quality (0-100)

Examples

# Compress a single file
python .../compress_screenshots.py screenshot.png

# Compress all images in a directory
python .../compress_screenshots.py ./images/

# Recursive directory scan
python .../compress_screenshots.py ./docs/ --recursive

# High quality for code screenshots
python .../compress_screenshots.py *.png --png-quality 90-100

# Aggressive compression for thumbnails
python .../compress_screenshots.py *.jpg --jpeg-quality 70

Quality Tuning Guide

Scenario--png-quality--jpeg-quality
General screenshots (docs, web pages)80-9585
Code screenshots (need sharp text)90-10090
Thumbnails / previews (size priority)60-8070

How It Works

PNG (pngquant)

  • Quantizes 24-bit true color (16M colors) down to an 8-bit palette (256 colors)
  • Uses Floyd-Steinberg dithering for smooth gradients
  • Screenshots are ideal candidates — UI colors are typically well under 256 unique values
  • Typical reduction: 60-80%

JPEG (jpegoptim)

  • Re-encodes at the specified quality level
  • Strips metadata (EXIF, ICC profiles, thumbnails) via --strip-all
  • Optimizes Huffman tables
  • Typical reduction: 20-50%

Important Notes

  • Files are compressed in place — the original is overwritten. Back up files first if needed.
  • Only .png, .jpg, and .jpeg files are processed. Other formats are silently skipped.
  • The script never installs dependencies. If tools are missing, it prints install instructions and exits.