# Compress Images to Smaller Files

Large image files slow uploads, pages, and storage workflows. This skill compresses supported images into WebP, PNG, or JPEG files with configurable quality and batch processing.

## Install

```bash
npx skillstore add jimliu/baoyu-compress-image
```

## Metadata

- Status: approved
- Slug: jimliu-baoyu-compress-image
- Version: 1.56.1
- Author version: 1.56.1
- Skillstore revision: r2
- Version status: valid
- Tree hash: 0948102c0bdb71d534be6b8a40c1eff1ae460d62e02aee418e0266d9de45c403
- Author: jimliu
- GitHub username: jimliu
- License: MIT
- Repository: https://github.com/jimliu/baoyu-skills/tree/main/skills/baoyu-compress-image/
- Ref: 1c2ebded2116f8124f45dba86a2e567f56e64d8e
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: scripts, external\_commands, network, filesystem
- Quality score: 71
- Public page: https://skillstore.pages.dev/skills/jimliu-baoyu-compress-image
- Manifest: https://skillstore.pages.dev/api/skills/jimliu-baoyu-compress-image/manifest

## Capabilities

- Compresses PNG, JPG, JPEG, WebP, GIF, and TIFF files.
- Outputs WebP, PNG, or JPEG with quality values from 0 to 100.
- Uses available sips, cwebp, ImageMagick, or Sharp tooling.
- Processes a directory and can include nested directories.
- Reports input size, output size, ratio, and compressor details.
- Can preserve the source image with the keep option.

## Use Cases

- Prepare Website Assets: Convert and compress images before publishing them to reduce page weight and improve delivery performance.
- Optimize Design Deliverables: Create smaller WebP, PNG, or JPEG copies for design handoffs, previews, and documentation.
- Process Image Folders: Compress supported images in a folder with consistent format and quality settings for an organized asset library.

## Prompt Templates

### Compress One Image

```
Compress the image at [path] to WebP using the default quality. Keep the original file.
```

### Choose Output Quality

```
Convert [path] to JPEG at quality [0-100]. Keep the original and report the size change.
```

### Optimize a Folder

```
Compress all supported images in [folder] recursively to WebP at quality [0-100]. Keep the originals and summarize the results.
```

### Create Reproducible Assets

```
Process [folder] into [format] at quality [0-100] with originals preserved. Return machine-readable results and identify any failed files.
```

## Limitations

- The tool requires Bun or an npx-based Bun runtime.
- The source image is renamed by default unless the keep option is enabled.
- Compression quality and output size vary by image content and selected format.
- It does not provide visual comparison, crop controls, or cloud storage.

## Best Practices

- Use the keep option when source files must remain at their original paths.
- Test quality settings on representative images before processing a large folder.
- Review the output report for failed files and unexpected size increases.

## Anti Patterns

- Do not process irreplaceable originals without enabling the keep option.
- Do not assume one quality value produces the same visual result across formats.
- Do not use recursive processing on folders containing unrelated image assets.

## Security Audit

- Audited at: 2026-08-07T10:18:40.466\+00:00
- Summary: The static alerts are false positives for this image utility: dynamic import, fixed-tool subprocess calls, template literals, metadata URLs, and documented configuration paths have benign context. A medium contextual finding remains because the default workflow renames the source image, which can disrupt path-based references.

## Stats

- Views: 173
- Downloads: 9
- Favorites: 1
- Popularity score: 0
