AI Agent Hub
Back to skills
Image Compression icon

Image Compression

Design & Media Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please follow https://skillhub.cn/install/skillhub.md and install @user_13f0f8f8/image-new.

About this skill

The problem

Images often need to be smaller before upload, sharing, or front-end delivery. Saving originals as-is increases storage and loading costs. Adjusting quality, dimensions, and format by hand is repetitive, and batch work can easily lose directory structure. image-compress turns this into a reusable compression flow: it can process a single image, a directory, or files matched by a glob pattern, then display a summary table for verification.

How it works

The skill prepares a Python Pillow-based compression script and runs it with the supplied arguments. Core capabilities include:

  • Quality control: --quality / -q sets output quality from 1 to 100, defaulting to 85; lower values generally produce smaller files.
  • Format conversion: supports jpeg, png, and webp output, defaulting to the input format.
  • Dimension limits: --max-width and --max-height constrain pixel size while preserving aspect ratio.
  • Batch handling: for directories or glob input, output defaults to ./compressed and preserves the input directory hierarchy.
  • Lossless option: --lossless is available for PNG and WebP only.

Boundaries and notes

The skill relies on a Python environment with Pillow. On some Windows setups, python3 may be a Store stub, while python is the usable command. JPEG output converts RGBA images to RGB. EXIF metadata is preserved unless explicitly stripped, so publish-ready assets should be reviewed separately. Lossless compression does not apply to every input format.

Use Cases

  • A front-end engineer compresses directory PNG files into WebP and limits width before upload.
  • A data labeling vendor lowers JPEG quality to 85 while keeping EXIF before delivery.
  • An operations staff member matches ./images/**/*.png with a glob and outputs to ./compressed.
  • A designer losslessly compresses Logo PNG files and checks the resulting file sizes before handoff.

Best For

  • Front-end engineers optimizing page performance who need smaller static image assets.
  • Operations staff managing product photos who need uniformly sized WebP batches.
  • Designers delivering brand assets who need lossless PNG compression and preserved folders.
  • Algorithm engineers cleaning datasets who need quality-controlled image compression.