All skills
jimliu avatar

/baoyu-compress-image

@2c800c6 official
by Jim Liu 宝玉jimliu/baoyu-skills26k stars
2,896

Compresses images to WebP (default) or PNG with automatic tool selection. Use when user asks to "compress image", "optimize image", "convert to webp", or reduce image file size.

Use this Skill: https://skilld.dev/gh/jimliu/baoyu-skills/baoyu-compress-image

This session only. Nothing lands on disk.

SKILL.md

≈50 tokens always: the name and description. ≈503 when used: this file.

Image Compressor

Compresses images using best available tool (sips → cwebp → ImageMagick → Sharp).

Script Directory

Scripts in scripts/ subdirectory. {baseDir} = this SKILL.md's directory path. Resolve ${BUN_X} runtime: if bun installed → bun; if npx available → npx -y bun; else suggest installing bun. Replace {baseDir} and ${BUN_X} with actual values.

Script Purpose
scripts/main.ts Image compression CLI

Preferences (EXTEND.md)

Check EXTEND.md in priority order — the first one found wins:

Priority Path Scope
1 .baoyu-skills/baoyu-compress-image/EXTEND.md Project
2 ${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-compress-image/EXTEND.md XDG
3 $HOME/.baoyu-skills/baoyu-compress-image/EXTEND.md User home

If none found, use defaults.

EXTEND.md supports: Default format, default quality, keep-original preference.

Usage

${BUN_X} {baseDir}/scripts/main.ts <input> [options]

Options

Option Short Description Default
<input> File or directory Required
--output -o Output path Same path, new ext
--format -f webp, png, jpeg webp
--quality -q Quality 0-100 80
--keep -k Keep original false
--recursive -r Process subdirs false
--json JSON output false

Examples

# Single file → WebP (replaces original)
${BUN_X} {baseDir}/scripts/main.ts image.png

# Keep PNG format
${BUN_X} {baseDir}/scripts/main.ts image.png -f png --keep

# Directory recursive
${BUN_X} {baseDir}/scripts/main.ts ./images/ -r -q 75

# JSON output
${BUN_X} {baseDir}/scripts/main.ts image.png --json

Output:

image.png → image.webp (245KB → 89KB, 64% reduction)

Extension Support

Custom configurations via EXTEND.md. See Preferences section for paths and supported options.

Source: SKILL.md on GitHub

No alerts16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    A utility skill for compressing images into WebP, PNG, or JPEG formats using system tools or the Sharp library. It follows security best practices for command execution and file handling.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    1/2 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 2c800c6. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated 6 months ago
version
1.56.1
Other metadata
metadata
{
  "openclaw": {
    "homepage": "https://github.com/JimLiu/baoyu-skills#baoyu-compress-image",
    "requires": {
      "anyBins": [
        "bun",
        "npx"
      ]
    }
  }
}

README badge

README badge for jimliu/baoyu-skills/baoyu-compress-image

Compresses images to WebP or PNG format by automatically selecting the best available tool (sips, cwebp, ImageMagick, or Sharp). Reduces file size with configurable quality settings and supports batch processing of directories.

Generated from the current SKILL.md.

What image formats does this skill support?
Input formats are unrestricted (PNG, JPEG, GIF, etc.). Output formats are WebP (default), PNG, or JPEG. The skill auto-selects the best available compression tool (sips, cwebp, ImageMagick, or Sharp).
Does this skill require bun to be installed?
Bun or npx must be available. If bun is installed, it runs directly; otherwise the skill falls back to npx -y bun.
Can I process multiple images at once?
Yes. Pass a directory path with the `--recursive` flag to compress all images in that directory and subdirectories.
Can I customize default quality or output format?
Yes. Create an EXTEND.md file in one of the config directories (.baoyu-skills, XDG_CONFIG_HOME, or home) to set default format, quality, and keep-original preference.
What happens to the original file?
By default, the original is replaced with the compressed version. Use the `--keep` flag to preserve both files.

Generated from the current SKILL.md. These answers refresh after source changes.