Files
u-claw/portable/skills/en/image-compress/SKILL.md
zheng dd8e0f55c3 fix(portable): Gemini keys, Telegram pairing UI, and config durability
Improve first-run and channel setup for non-technical users: detect newer
Gemini key formats, pin Node 22.22.3, add Control Panel Telegram approve
flow, and keep channels/models when config is rewritten. Persist uclaw
wizard state via uclaw-meta.json so restarts skip language/persona prompts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 18:45:03 +08:00

53 lines
1.6 KiB
Markdown

---
name: image-compress
description: "Image compression and conversion - shrink, resize, convert jpg/png/webp. Runs locally."
metadata: { "openclaw": { "emoji": "🖼️" } }
---
# Image Compression / Conversion
Shrink image file sizes, change dimensions, convert between formats. Everything
runs on this machine — photos are never uploaded.
## What it does
- **Compress**: reduce file size by quality or resolution, for email and messaging
- **Resize**: scale by dimension or percentage
- **Convert**: jpg / png / webp (webp is usually smallest)
- **Batch**: process a whole folder
## How to run it
Use the Bash tool with Python's Pillow — cross-platform and entirely local.
```bash
python -c "import PIL" 2>/dev/null || pip install -q Pillow
# Single image: quality 75, cap width at 1600px, keep aspect ratio
python - <<'PY'
from PIL import Image
im = Image.open("input.jpg")
if im.width > 1600:
im = im.resize((1600, int(im.height * 1600 / im.width)))
im.convert("RGB").save("output.jpg", "JPEG", quality=75, optimize=True)
print("compressed -> output.jpg")
PY
# Batch: every jpg/png in this folder -> webp
python - <<'PY'
from PIL import Image
import glob, os
for f in glob.glob("*.jpg") + glob.glob("*.png"):
out = os.path.splitext(f)[0] + ".webp"
Image.open(f).save(out, "WEBP", quality=80)
print(f"{f} -> {out}")
PY
```
## Working notes
- Run `ls -lh` before and after, and tell the user how much was actually saved
- Never overwrite the original unless the user explicitly asks — write a new file
- PNG transparency is lost when converting to JPG but survives in webp; pick the
format based on whether the image has an alpha channel