web-ready
Use when the user wants to take a folder of images (any mix of HEIC, RAW, PNG, JPEG, TIFF, WebP) and produce a web-ready set — EXIF stripped, resized to a sensible max dimension, encoded in modern formats (AVIF + WebP, with JPEG fallback), and optimized for size. End-to-end orchestrator over the single-purpose skills in this plugin. Triggers - "make this folder web-ready", "prep these photos for upload", "get these images ready for my blog".
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- web-ready
- description
- Use when the user wants to take a folder of images (any mix of HEIC, RAW, PNG, JPEG, TIFF, WebP) and produce a web-ready set — EXIF stripped, resized to a sensible max dimension, encoded in modern formats (AVIF + WebP, with JPEG fallback), and optimized for size. End-to-end orchestrator over the single-purpose skills in this plugin. Triggers - "make this folder web-ready", "prep these photos for upload", "get these images ready for my blog".
- allowed-tools
- Bash(which *), Bash(command *), Bash(test *), Bash(brew *), Bash(magick *), Bash(convert *), Bash(identify *), Bash(exiftool *), Bash(vips *), Bash(vipsthumbnail *), Bash(vipsheader *), Bash(heif-convert *), Bash(darktable-cli *), Bash(avifenc *), Bash(cwebp *), Bash(cjpeg *), Bash(jpegoptim *), Bash(oxipng *), Bash(mkdir *), Bash(mktemp *), Bash(cp *), Bash(mv *), Bash(rm *), Bash(find *), Bash(wc *), Read, Write
03 SKILL.md 正文
Web-Ready (orchestrator)
One-shot pipeline: ingest anything → strip EXIF → resize → encode to web formats → optimize. The "make this folder uploadable" skill.
When to use
- Photos coming off a phone (HEIC) destined for a blog.
- Camera RAW exports being prepped for an online gallery.
- A mixed folder of screenshots/photos that needs to ship to the web.
- Pre-step before image upload to any CMS, S3 bucket, or Cloudflare R2.
Do not use this skill when:
- The user wants archival output → keep originals; use the targeted skills (
to-jxl,transcode-jpeg-to-jxl-lossless,optimize-png). - The user wants pixel-perfect originals on the web (rare, e.g. art prints) → use
optimize-png/optimize-jpegonly, no resize. - Single-file conversion → call the underlying skill directly.
Inputs
- Input directory — required.
- Profile — preset bundle. One of:
blog(default): max-side 2000px, AVIF q60 + WebP q80 + JPEG q82 fallback, EXIF stripped.gallery: max-side 3000px, AVIF q70 + WebP q85, EXIF stripped.thumbnail: max-side 800px, AVIF q55 + WebP q75, EXIF stripped.archival-web: max-side 4000px, AVIF q80 + WebP q90, EXIF preserved.
- Custom overrides — any of
--max-side N,--avif-q N,--webp-q N,--jpeg-q N,--keep-exif,--no-jpeg-fallback. - Output dir — default:
<input>/web/. Inside:web/avif/,web/webp/,web/jpg/parallel trees so the user can pick which set to upload. - Recursive —
--recursive. Mirrors subdirectory layout.
Procedure
-
Pre-flight: check each tool the pipeline needs and record which are present:
for t in magick exiftool vipsthumbnail avifenc cwebp cjpeg oxipng jpegoptim \ heif-convert darktable-cli do command -v "$t" >/dev/null && echo "ok $t" || echo "MISS $t" donemagickandexiftoolare required — stop and point atimage-ops-install-depsif either is missing. The rest are optional: a missing encoder drops its output format from the pipeline with a one-line note, and a missingheif-convert/darktable-clinarrows which sources can be ingested (stage 1).For the mozjpeg-quality JPEG fallback, resolve
$MOZ_BINas described inoptimize-jpegstep 1 — a barecjpegon PATH is libjpeg-turbo, not mozjpeg. -
Stage 1: Stage and decode inputs. Every later stage works on files in a private staging directory, never the input tree:
stage="$(mktemp -d "${TMPDIR:-/tmp}/web-ready.XXXXXX")"Each file gets a staged copy at
$stage/<relative-path>(mirroring subdirectories avoids name collisions):- JPEG/PNG/WebP/TIFF → copy:
mkdir -p "$(dirname "$staged")" && cp -p "$input" "$staged". Never pass the original itself through: stage 2 rewrites$stagedin place. - HEIC → decode to PNG via
heif-convert(or viavipsthumbnailif libvips has libheif). Fail loud if neither is available. - RAW (CR2, ARW, NEF, DNG, ORF, RAF) → decode via
darktable-cli "$input" "$staged.tiff". There is no libvips fallback here: libvips ships no camera-RAW decoder for these formats (a DNG that happens to be TIFF-wrapped may partially load via tiffload, but CR2/ARW/NEF/ORF/RAF will not). Ifdarktable-cliis missing, skip the file with a flagged warning naming the format, and tell the user in the summary that RAW ingestion needsdarktable-cliinstalled. - Anything else (BMP, GIF, etc.) → copy, as for JPEG/PNG.
- JPEG/PNG/WebP/TIFF → copy:
-
Stage 2: Strip EXIF. Unless
--keep-exifset, on the staged copy only:case "$staged" in "$stage"/*) ;; *) echo "refusing to strip outside staging: $staged" >&2; exit 1 ;; esac exiftool -all= --ICC_Profile:all -tagsfromfile @ -Orientation -ColorSpace "$staged"This rewrites
$stagedin place, which is safe only because it is a copy. Thecaseguard enforces that. exiftool's<file>_originalbackup stays in$stageand goes at cleanup. KeepOrientation,ColorSpaceand the ICC profile (--ICC_Profile:allexcludes it from-all=). Without the profile, colours in a Display P3 or Adobe RGB photo shift. -
Stage 3: Resize. Per file, fit within
<max-side>box preserving aspect:vipsthumbnail "$staged" --size "${max_side}x${max_side}" --output "$resized.png[Q=100]"Use lossless intermediate to avoid double-compression. Skip if the source's longest side is already ≤ max-side.
-
Stage 4: Encode. For each survivor, produce up to three outputs:
-
AVIF:
avifenc -q "$avif_q" -s 6 "$resized.png" "$out/avif/$basename.avif".avifenccopies the source's EXIF/XMP, and stage 2 has already removed them unless--keep-exifis set. -
WebP:
cwebp -q "$webp_q" "$resized.png" -o "$out/webp/$basename.webp" -
JPEG fallback (unless
--no-jpeg-fallback):cjpegcannot read PNG — it decodes PPM/PGM/BMP/Targa only — so the stage-3 PNG must be decoded first:magick "$resized.png" ppm:- \ | "$MOZ_BIN/cjpeg" -quality "$jpeg_q" -progressive -optimize \ > "$out/jpg/$basename.jpg"If
$MOZ_BINdid not resolve in pre-flight, use ImageMagick end to end instead — slightly larger output, but it reads PNG natively:magick "$resized.png" -quality "$jpeg_q" -interlace Plane "$out/jpg/$basename.jpg"
Run encodes in parallel — they're independent. Check each encoder's exit status and record failures per file and per format; a format that fails for one file must not abort the other two or the rest of the batch.
-
-
Stage 5: Optimize (final squeeze).
- JPEGs:
jpegoptim --strip-com --strip-exif --strip-iptc --strip-xmp --all-progressivein-place onweb/jpg/. Avoid--strip-all, which also removes the ICC profile. With--keep-exif, drop the--strip-*flags. - PNGs (only if any survived as PNG, e.g. with
--no-jpeg-fallback):oxipng -o 4 --strip safe. - AVIF / WebP: avifenc and cwebp already produce near-optimal output; no second pass.
- JPEGs:
-
Cleanup:
rm -rf "$stage"(only the staging directory). Write a manifest at<output>/manifest.jsonmapping<original-path> → {avif, webp, jpg}plus per-file size deltas.
Output
- Three parallel trees under
<output-dir>:avif/,webp/,jpg/. manifest.jsonwith the mapping and size table.- Summary report:
- Files processed / skipped / failed (with reasons).
- Total bytes per format. Typical:
<orig> → AVIF <X>%, WebP <Y>%, JPEG <Z>%. - Recommendation line: which format to upload (AVIF if all targets support it; WebP otherwise; JPEG as universal fallback).
Notes
- Defaults are tuned for the
blogprofile.galleryandarchival-webraise quality for slower-but-better output. - The orchestrator never modifies originals. Every destructive step runs on a copy in
$stage, and the output tree is separate. - Companion skills:
convert-to-avif(single-format),optimize-png,optimize-jpeg,fast-resize; plus the/convert-to-webpcommand for single-format WebP. This orchestrator composes the same tools; the user is welcome to use the components directly when they want finer control.
04 同仓库更多 Skills
no-description
暂无简介
good-skill
Fixture skill that satisfies every rule.
broken-link
Links to a reference file that does not exist.
Bad_Name
Name violates the kebab-case rule and does not match the directory.
skill-authoring
Write, review, and validate portable agent skills in SKILL.md format. Use when creating a new skill, editing an existing one, or asked whether a skill follows the Agent Skills spec.
weigh-bags
Record scale readings for each bag — empty (tare), outbound, current, final — and reconcile them against the itemised inventory to find unaccounted weight. Use when the user gives a bag weight, says how heavy something is, weighs their luggage, or asks how close to the limit they are. Appends to bags.yaml and runs scripts/reconcile.py.