baoyu-compress-image

Compresses images to JPEG/WebP/PNG using an automated multi-platform CLI (sips, cwebp, sharp). Washed for Obsidian Creator Vault: defaults to JPEG at 65 quality (for <1MB output), and auto-archives original files.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "baoyu-compress-image" with this command: npx skills add tentacle-pro/skills/tentacle-pro-skills-baoyu-compress-image

baoyu-compress-image

Auto-compresses images using the best available CLI tool on the system (sips, cwebp, convert, or sharp).

This has been specifically adapted for the Obsidian Creator Vault:

  • Fast Web-focused: Defaults to generating .jpg with 65 quality (perfect for most platform limits < 1MB).
  • Clean Vault: When run in default mode (replace), it doesn't clutter your Assets/ with _original files. Instead, it backs up the original unmodified file to Archive/Original-Images/.
  • Dependency Sandboxing: All runtime is wrapped through bun and isolated inside .agents/skills.

Installation & System Requirements

This script automatically detects your OS and uses the fastest and highest quality image engine it can find in this order:

  1. macOS sips (Built-in, Highly Recommended)
    macOS ships with sips natively. No installation required.
    (Under the hood: sips -s format jpeg -s formatOptions 65 <input> --out <output>)

  2. cwebp (Best for webp targets)

    • macOS: brew install webp
    • Ubuntu/Debian: sudo apt install webp
  3. ImageMagick (convert)

    • macOS: brew install imagemagick
    • Linux: sudo apt install imagemagick
  4. sharp (Node.js fallback for Windows / Non-Native Envs)
    Automatically installed when you run the local bun install command. The sharp engine handles compression via libvips without needing external binaries.

First Time Setup (TS Environment):

cd .agents/skills/baoyu-compress-image
bun install

Usage

Run the script using bun from the root of the vault.

bun .agents/skills/baoyu-compress-image/scripts/main.ts <input> [options]

Options

OptionShortDescriptionDefault
<input>Input target (File or directory)Required
--output-oStrict output file pathSame dir as input
--format-fOutput format (jpeg, webp, png)jpeg
--quality-qQuality Level 0-10065
--keep-kKeep original file in-place (don't archive it)false
--recursive-rProcess directories recursivelyfalse

Examples & Workflows

1. Compress a generated AI image for publishing (Default)

bun .agents/skills/baoyu-compress-image/scripts/main.ts Assets/cover-draft.png

Effect: It creates Assets/cover-draft.jpg and safely moves cover-draft.png out of the way into Archive/Original-Images/.

2. Compress an image but keep it as WebP format

bun .agents/skills/baoyu-compress-image/scripts/main.ts Assets/screenshot.png -f webp

3. Test different quality manually and keep the original there

bun .agents/skills/baoyu-compress-image/scripts/main.ts Assets/photo.png -q 80 --keep

4. Batch-compress an entire directory

bun .agents/skills/baoyu-compress-image/scripts/main.ts "00 Inbox/" -r

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

baoyu-post-to-wechat

No summary provided by upstream source.

Repository SourceNeeds Review
General

baoyu-cover-image

No summary provided by upstream source.

Repository SourceNeeds Review
General

baoyu-markdown-to-html

No summary provided by upstream source.

Repository SourceNeeds Review
General

baoyu-article-illustrator

No summary provided by upstream source.

Repository SourceNeeds Review