Skills jimliu baoyu-skills

baoyu-compress-image

Use it when:
Images are too large and you want them smaller, or converted to WebP.
It does:
Runs a bundled script that uses the first of sips, cwebp, ImageMagick or Sharp it finds.
You get:
WebP files at quality 80 by default, or PNG or JPEG, with each file's size before and after.
Watch out:
It replaces the original unless you pass --keep.
Needs:
Bun or npx.

It replaces the original file unless you ask it to keep it.

TL;DR

A small utility. It takes one file or a whole folder, recursively if asked, and writes each result at the same path with the new extension, or wherever you point it. Quality runs from 0 to 100. Defaults for the format, the quality and keeping originals can be set in a preferences file, and it can report in JSON.

Summarizes the skill at ca703c2.

npx skills add https://github.com/jimliu/baoyu-skills --skill baoyu-compress-image
Total Downloads
28,600 on skills.sh, Nov 9, 2026
Repo stars
27,397 jimliu/baoyu-skills
First seen
Jan 19, 2026 on skills.sh
Weekly Downloads
200
-30% over the 8 weeks to Nov 9
Weekly values
Week toInstalls
Sep 21284
Sep 28110
Oct 5105
Oct 12155
Oct 19141
Oct 26155
Nov 2171
Nov 9200
Category

Generate and edit video, images and audio.

Type

Operates a CLI, API, app or bundled script to get something done.

Effect

Its own steps create or change files, git state or local tools.

Needs

A specific command-line tool or desktop app must be installed, such as gh, agent-browser, LibreOffice, Obsidian or a vendor CLI.

Publisher

Everyone else. Unverified vendor claims default to community.

Topics

SKILL.md

From jimliu/baoyu-skills at ca703c2. Checked daily, last changed Nov 6, 2026.

Frontmatter
name: baoyu-compress-image
description: 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.
version: 1.56.1
metadata:
  openclaw:
    homepage: https://github.com/JimLiu/baoyu-skills#baoyu-compress-image
    requires:
      anyBins:
        - bun
        - npx

Image Compressor

Tool auto-selection order: sips → cwebp → ImageMagick → Sharp.

Script Directory

{baseDir} = this SKILL.md's directory. Resolve ${BUN_X}: bun if installed; else 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)

First 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]
${BUN_X} {baseDir}/scripts/main.ts image.png                    # → WebP, replaces original
${BUN_X} {baseDir}/scripts/main.ts image.png -f png --keep      # keep PNG format and original
${BUN_X} {baseDir}/scripts/main.ts ./images/ -r -q 75           # directory, recursive

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

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

Extension Support

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