Agent skill

Image Compressor

by JimLiu in JimLiu/baoyu-skills

Compresses images to WebP by default, or to PNG or JPEG, picking the best available tool on the machine and optionally processing whole folders.

MITAuto-check passedMedia & Creative

Install Image Compressor

skills CLI
$ npx skills add JimLiu/baoyu-skills --skill baoyu-compress-image -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install JimLiu/baoyu-skills baoyu-compress-image --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/JimLiu/baoyu-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/baoyu-compress-image .claude/skills/baoyu-compress-image && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
baoyu-compress-image
GitHub stars
27k
Used in
5 other repos
Token cost
~598 tokens
SKILL.md length
151 words
Files
2 (incl. scripts)
Skills in repo
22
Repo updated
First seen
Licence
MIT

At a glance

Compresses images to WebP by default, or to PNG or JPEG, picking the best available tool on the machine and optionally processing whole folders.

  • Reducing the file size of images before publishing a site or post
  • SKILL.md covers Script Directory, Preferences (EXTEND.md), Usage and Options, plus 2 more sections
  • Runs TypeScript scripts from its folder; calls npx
  • Converting PNG or JPEG files to WebP

What it does

The agent runs a TypeScript script, `scripts/main.ts`, on a single file or a directory, launching it with bun or with `npx -y bun`. It uses the first compression tool it finds in this order: sips, cwebp, ImageMagick, then Sharp. Output defaults to WebP at quality 80, and the original is replaced unless you ask to keep it.

Options set the output path, the format (webp, png or jpeg), quality from 0 to 100, recursion into subfolders and JSON output. The result is printed as a line showing the size before and after. Defaults for format, quality and keeping the original can be stored in an `EXTEND.md` file at project level, in the XDG config folder or in the home directory, and the first one found wins.

When your agent uses it

  • Reducing the file size of images before publishing a site or post
  • Converting PNG or JPEG files to WebP
  • Batch-compressing a whole folder of screenshots

Example prompts

  • “Compress every PNG in ./public/images to WebP and keep the originals.”
  • “Optimize hero.png and show me how much smaller it got.”
  • “Convert everything in ./screenshots to JPEG at a lower quality, including subfolders.”

Requirements

  • bun, or `npx` to launch it
  • One of sips, cwebp, ImageMagick or Sharp

What it can do on your machine

Read from SKILL.md and the folder at commit 1567581. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (TypeScript), which the agent can run.

    Shell commands in SKILL.md call:

    • npx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npx, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Image Compressor loads about 598 tokens when it runs. Until then it costs about 50 tokens; SKILL.md has 151 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~50
When it runs · the whole SKILL.md, loaded when a task matches
~598

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from JimLiu/baoyu-skills at commit 1567581, republished under its MIT licence (© JimLiu). 151 words, ~598 tokens.

Download SKILL.mdSave it as .claude/skills/baoyu-compress-image/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
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

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.

ScriptPurpose
scripts/main.tsImage compression CLI

Preferences (EXTEND.md)

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

PriorityPathScope
1.baoyu-skills/baoyu-compress-image/EXTEND.mdProject
2${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-compress-image/EXTEND.mdXDG
3$HOME/.baoyu-skills/baoyu-compress-image/EXTEND.mdUser home

If none found, use defaults.

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

Usage

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

Options

OptionShortDescriptionDefault
<input>File or directoryRequired
--output-oOutput pathSame path, new ext
--format-fwebp, png, jpegwebp
--quality-qQuality 0-10080
--keep-kKeep originalfalse
--recursive-rProcess subdirsfalse
--jsonJSON outputfalse

Examples

bash
# 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.

© JimLiu, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (scripts) in skills/baoyu-compress-image of JimLiu/baoyu-skills.

  • SKILL.md
  • scripts/main.ts

Open the folder on GitHubat commit 1567581

Used in 5 other repositories

We found 5 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 5 other GitHub owners. This page covers the copy in JimLiu/baoyu-skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Image Compressor next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Image Compressor compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Image Compressor this skillJimLiu/baoyu-skills27k5 repos~598Automated safety check: PassMIT
AI Image Generation and Editingzhayujie/CowAgent47k—~1.3kAutomated safety check: PassMIT
Generate Imageynulihao/AgentSkillOS61810 repos~1.7kAutomated safety check: NotesNone
GPT Image Generation CLIwuyoscar/GPT-Image2-Skill5.7k—~2.5kAutomated safety check: NotesMIT
HyperFrames Media Useheygen-com/hyperframes60k—~2.4kAutomated safety check: PassApache-2.0
Media Useedenfunf/reelmimic1.9k1 repos~2kAutomated safety check: PassMIT

Similar skills

  • Generates or edits images from text prompts through a Python script that picks an image backend based on which API keys are configured.

    47k GitHub stars~1.3k tokensUpdated yesterday
    Media & CreativeAuto-check passed
  • Generate Image

    ynulihao/AgentSkillOS

    Generate or edit images using AI models (FLUX, Gemini). An agent skill from ynulihao/AgentSkillOS.

    618 GitHub starsUsed in 10 repos~1.7k tokens
    Media & CreativeAuto-check: notes
  • GPT Image Generation CLI

    wuyoscar/GPT-Image2-Skill

    Generates and edits images with GPT Image 2 or 2.5 through a packaged CLI and a prompt gallery, after settling which model fits the request.

    5.7k GitHub stars~2.5k tokensUpdated 10 days ago
    Media & CreativeAuto-check: notes
  • HyperFrames Media Use

    heygen-com/hyperframes

    Finds, generates and edits media for HyperFrames video projects: music, sound effects, images, icons, logos, voiceovers, captions and color grades.

    60k GitHub stars~2.4k tokensUpdated today
    Media & CreativeAuto-check passed
  • Media Use

    edenfunf/reelmimic

    Agent Media OS, the single skill for every media need in a HyperFrames project.

    1.9k GitHub starsUsed in 1 repo~2k tokens
    Media & CreativeAuto-check passed
  • Gemini Watermark Remover

    GargantuaX/gemini-watermark-remover

    Removes visible Gemini watermarks from local image files by running the project's bundled Node script and saving the cleaned copies to a chosen output location.

    5.6k GitHub stars~308 tokensUpdated 6 days ago
    Media & CreativeAuto-check passed

More from JimLiu/baoyu-skills

All 22 skills in this repo
  • Markdown Article Formatter

    JimLiu/baoyu-skills

    Reformats plain text or Markdown articles with frontmatter, a title, a summary, headings, bold, lists and code blocks, and saves a separate formatted copy.

    27k GitHub starsUsed in 6 repos~3.5k tokens
    Auto-check passed
  • X to Markdown Converter

    JimLiu/baoyu-skills

    Saves tweets, threads and X Articles as Markdown files with YAML front matter, using an unofficial API that asks for your consent first.

    27k GitHub starsUsed in 4 repos~1.8k tokens
    Auto-check: warnings
  • SVG Diagram Generator

    JimLiu/baoyu-skills

    Creates standalone dark-themed SVG diagrams, including architecture, flowchart, sequence, structural, mind map, timeline and state machine types.

    27k GitHub starsUsed in 1 repo~3.1k tokens
    Auto-check passed
  • Publishes articles and image-text posts to a WeChat Official Account through the API or Chrome CDP, converting markdown to WeChat-ready HTML with link citations.

    27k GitHub starsUsed in 2 repos~3.6k tokens
    Auto-check: warnings
  • Generates text and images through an unofficial, reverse-engineered Gemini Web API, supporting reference images and multi-turn conversations.

    27k GitHub starsUsed in 5 repos~1.6k tokens
    Auto-check passed
  • Baoyu Translate

    JimLiu/baoyu-skills

    Translates articles and files in quick, normal or refined mode, with a custom glossary, saved preferences and a review-and-polish workflow for publication quality.

    27k GitHub starsUsed in 1 repo~3.9k tokens
    Auto-check passed

Questions about Image Compressor

What does Image Compressor do?

Compresses images to WebP by default, or to PNG or JPEG, picking the best available tool on the machine and optionally processing whole folders. ts`, on a single file or a directory, launching it with bun or with `npx -y bun`. It uses the first compression tool it finds in this order: sips, cwebp, ImageMagick, then Sharp.

When should I use Image Compressor?

Image Compressor fits situations like: reducing the file size of images before publishing a site or post; converting PNG or JPEG files to WebP; batch-compressing a whole folder of screenshots.

How do I install Image Compressor in Claude Code?

Run `npx skills add JimLiu/baoyu-skills --skill baoyu-compress-image -a claude-code`. Or copy the skill folder (skills/baoyu-compress-image in JimLiu/baoyu-skills) into .claude/skills/baoyu-compress-image in your project. Claude Code loads it when a task matches its description.

How do I install Image Compressor in Codex?

Run `npx skills add JimLiu/baoyu-skills --skill baoyu-compress-image -a codex`. Or copy the skill folder (skills/baoyu-compress-image in JimLiu/baoyu-skills) into .agents/skills/baoyu-compress-image in your project. Codex loads it when a task matches its description.

Can I use Image Compressor in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add JimLiu/baoyu-skills --skill baoyu-compress-image -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/baoyu-compress-image, .gemini/skills/baoyu-compress-image, .github/skills/baoyu-compress-image and .opencode/skills/baoyu-compress-image in your project.

What does Image Compressor need to run?

Going by SKILL.md and its folder, Image Compressor needs TypeScript for the scripts in its folder and the command-line tools its instructions call (npx). Our summary lists: bun, or `npx` to launch it; One of sips, cwebp, ImageMagick or Sharp.

Does Image Compressor access the network?

SKILL.md contains no URLs. Its commands use npx, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Image Compressor safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Image Compressor use?

Image Compressor is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Image Compressor use?

About 598 tokens (SKILL.md is roughly 2.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Image Compressor?

Skills that share tags, products or a category with Image Compressor: AI Image Generation and Editing (zhayujie/CowAgent, 47k stars), Generate Image (ynulihao/AgentSkillOS, 618 stars), GPT Image Generation CLI (wuyoscar/GPT-Image2-Skill, 5.7k stars) and HyperFrames Media Use (heygen-com/hyperframes, 60k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Image Compressor?

JimLiu (a GitHub user) maintains it in JimLiu/baoyu-skills, which has 26,507 GitHub stars. The repository holds 22 skills in this directory. The repository was last updated on September 10, 2026.

Source: JimLiu/baoyu-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.