Install
openclaw skills install compress-imageCompress or convert generated images for delivery, preview, and social upload. Use when the user asks to compress an image, optimize image size, convert to webp, or reduce file size after generation.
openclaw skills install compress-imagecompress-image)Compress or convert generated images for delivery, preview, and social upload. Optimize image size, convert to webp, or reduce file size after generation.
This skill uses the best available local toolchain and stays self-contained.
When this skill is triggered for the first time in a project or environment, run:
npm run ensure-ready -- --project .
This checks whether at least one supported local compressor is available.
sips, cwebp, or ImageMagick and offer to install one on the user's behalf.Script:
scripts/main.tswebpCompress my cover image to webp for social uploadOptimize all images in the output directory to reduce file sizeConvert this PNG to a lighter webp format at quality 80Important: at least one of cwebp, magick, or sips must be available locally.
Preferred order:
cwebp for WebP outputmagick or convert for conversion and flexible processingsips as a macOS-native fallbackSee:
${BUN_X} {baseDir}/scripts/main.ts <input> [options]
| Option | Description |
|---|---|
<input> | input file or directory |
--output, -o | output file or directory |
--format, -f | webp, png, or jpeg (default: webp) |
--quality, -q | quality 0-100 (default: 80) |
--keep, -k | keep the original when the output extension matches the input |
--recursive, -r | process directories recursively |
--json | return JSON output |
Single image to WebP:
${BUN_X} {baseDir}/scripts/main.ts input.png -f webp -q 80
Single image to JPEG:
${BUN_X} {baseDir}/scripts/main.ts input.png -f jpeg -q 82
Recursive directory compression:
${BUN_X} {baseDir}/scripts/main.ts ./images -r -f webp
JSON output:
${BUN_X} {baseDir}/scripts/main.ts input.png --json
webp, png, or jpeg) and quality level.--recursive to handle nested folders.Recommended behavior:
compressed/ subdirectoryExample:
cover-image/topic-slug/
├── cover.png
└── compressed/
└── cover.webp
--keep is used and the output extension matches the input.--recursive re-processes all matching files in the directory, including previously compressed ones.--output to a separate compressed/ subdirectory.--keep is used with matching extensions.--format.--json mode produces a valid JSON summary with input size, output size, and compression ratio.npm run doctor -- --project .
npm run ensure-ready -- --project .
npm run setup -- --project .
setup does not write secrets because this skill has none; it simply confirms readiness and tells the user the next compression command to run.
cwebp -> magick / convert -> sips--keep when the output extension matches the inputwebp output requires cwebp or ImageMagick; if only sips is available, prefer png or jpeg