pp-image-compress

Compress PNG and JPEG images losslessly into a compressed subdirectory using Python and Pillow.

4|Updated Aug 4, 2026
One-click install
npx skills add https://github.com/double-coding-lab/PixelPrint --skill pp-image-compress-double-coding-lab
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pp-image-compress
Source: https://github.com/double-coding-lab/PixelPrint/tree/main/templates/skills/pp-image-compress
Command: npx skills add https://github.com/double-coding-lab/PixelPrint --skill pp-image-compress-double-coding-lab

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires Pillow.

What problem does it solve? Image folders in projects often contain unoptimized PNG and JPEG files that bloat repositories and slow down page loads. This Skill losslessly compresses those images in bulk while keeping originals untouched, with a mandatory dry-run preview so you always know what will change before anything is written to disk. ## Core Features & Use Cases - Lossless Compression: PNG uses Pillow's optimize mode with compress_level 9; JPEG keeps the original quantization tables (quality='keep') and only re-encodes entropy, preserving pixels, ICC profiles, and EXIF data. - Safe Dry-Run Workflow: Always previews candidate files, per-file savings, and total size reduction before writing; output goes to a compressed/ subdirectory so originals stay intact. - No-Gain Protection: Files that would grow larger are automatically kept as original bytes, so the output directory remains a complete drop-in replacement. - Use Case: Before shipping a web or mobile app, point the Skill at your assets/ folder to shrink dozens of PNG/JPEG images by 5–30% without any visual quality loss, then replace the originals with one copy command. ## Quick Start Ask the agent to losslessly compress the images in your assets folder, for example: "Run pp-image-compress on my src/assets folder and show me the dry-run preview first."

Frequently Asked Questions about pp-image-compress

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I losslessly compress PNG and JPEG images in a folder with Python?▼

Run the compress.py script with the target folder path after installing Pillow. It processes all PNG and JPEG files, writes results to a compressed subdirectory, and prints per-file and total size savings. Use --dry-run first to preview changes.

What Python library can compress images without losing quality?▼

Pillow supports lossless optimization for both PNG and JPEG. PNG uses optimize with compress_level 9 for bit-level lossless output, while JPEG uses quality='keep' to retain original quantization tables and only re-encode entropy progressively.

Does lossless JPEG compression preserve EXIF and ICC profile data?▼

Yes, the script explicitly passes icc_profile and exif metadata through to the saved file for both PNG and JPEG. Pixel data and embedded color profiles remain identical to the original image.

Why do some images show no size reduction after compression?▼

Images already optimized by tools like optipng often have no remaining gain, and JPEG re-encoding can occasionally produce slightly larger files. The script detects this and keeps the original bytes, reporting the file as no-gain.

Can I compress WebP, GIF, or SVG files with this tool?▼

No, only .png, .jpg, and .jpeg extensions are supported in the current version. Other formats like WebP, GIF, and SVG are automatically skipped during the folder scan.

Is it safe to overwrite original images in place?▼

The --overwrite flag replaces originals directly but is discouraged unless you have a separate backup. The default behavior writes to a compressed subdirectory, keeping originals untouched so you can verify results first.