resize-images · diff
git:20260812.ab1329f to git:20260920.ef0a19e
11 added, 78 removed. Audit A to A.
---
name: resize-images
- description: Batch-resize or convert a folder of images for web, social media, slides, or ARCH-size print output while preserving originals. Use for image resizing, format presets, or photo batches; not for product-image background removal.
+ description: "Batch-resize or convert a folder of images for web, social media, slides, or ARCH-size print output while preserving originals. Use for image resizing, format presets, or photo batches; not for product-image background removal."
allowed-tools:
- Read
- Bash
- Glob
- AskUserQuestion
---
# /as:resize-images — Image Resizer for Web, Social, and Print
- <!-- architecture-studio:harness-compatibility -->
- > Harness note: use `/as:<skill>` on Claude Code and `$<skill>` on Codex. Resolve `<skill-root>` as the directory containing this loaded `SKILL.md` and `<plugin-root>` as the plugin root that contains `skills/`, and use equivalent native tools when host tool names differ.
-
- Resize project photos and renders for web publishing, social media, and print layouts. Always asks the user for the source folder before doing anything. Outputs resized copies into clearly named subfolders — originals are never modified.
-
- ## Step 1: Ask for the source folder
-
- Before doing anything else, ask:
-
- > "Which folder contains the images you'd like to resize?"
-
- Wait for the user's response. Accept any valid path — absolute, relative, or with `~`. Expand `~` to the user's home directory.
-
- Then ask:
-
- > "Which outputs do you need? (choose one or more)
- > - **Web** — WebP at 1920px (hero), 1200px (standard), 400px (thumb)
- > - **Social** — center-cropped WebP: Instagram square (1080×1080), Instagram portrait (1080×1350), Twitter/X (1200×675), LinkedIn (1200×627)
- > - **Slides** — center-cropped JPEG: standard 4:3 (1024×768), widescreen 16:9 (1920×1080)
- > - **Print** — 300 DPI JPEG at ARCH A (9×12), ARCH B (12×18), ARCH C (18×24)
- > - **All**"
-
- ## Step 2: Scan the folder
-
- List supported files non-recursively: `.jpg`, `.jpeg`, `.png`, `.tif`, `.tiff`, and `.webp`. Report the count: `"Found N image(s) in [folder]. Ready to resize."`
-
- If the folder is empty or contains no supported images, tell the user and stop.
-
- ## Step 3: Check for Pillow
-
- Confirm Pillow is available:
-
- ```bash
- python3 -c "import PIL; print('ok')" 2>/dev/null || echo "missing"
- ```
-
- If missing, tell the user:
-
- > "Pillow isn't installed. Run `pip install Pillow` then try again."
-
- Stop if Pillow is unavailable.
-
- ## Step 4: Resize images
-
- Run the bundled processor once, passing the source folder and selected modes:
-
- ```bash
- python3 "<plugin-root>/skills/resize-images/scripts/resize_images.py" "<folder>" web social slides print
- ```
-
- Include only selected modes. The script creates the matching `resized-<mode>/` folders, preserves originals, reports each output, continues past corrupt inputs, and exits nonzero if any input fails. Never recreate or modify the script inline.
+ Before acting, read the [host contract](../../docs/host-harness-contract.md) and this component's [declaration](host-contract.json) (`skill:resize-images`). Compose only applicable modes from the [shared catalog](../../corpus/host-contracts.json); declarations do not prove access or permission. Use the actual host’s [delivery route](../../docs/host-adapters.md).
- ## Step 6: Report results
+ ## Select the requested batch
- After all files are processed, show a summary:
+ Resize photos and renders into requested copies while preserving originals. Reuse the supplied source folder and selected `web`, `social`, `slides` or `print` modes. Ask only for materially missing inputs, not information or authorization already supplied. This one-off operation requires no studio/project setup.
- ```
- Resized N image(s) → [folder]/resized-web/, resized-social/, resized-print/
+ Read the complete [native resize owner](../../tools/transformers/resize-images-contract.md) for `resize_images.resize`: exact input and output membership, all twelve preset labels/dimensions/encoding settings, width-only web behavior, center crop, print rounding/DPI, first-frame/color scope, literal collision checks, failure and retry semantics. Use the actual host's available tools; no installed Arch Studio runner, executable handoff or universal dependency installation is required. The presets are Arch Studio-authored sizes, not current external platform requirements. A different requested dimension/crop needs an actually supported separately selected route.
- Web (resized-web/):
- project-photo-hero.webp (1920×1385) 138 KB
- project-photo-standard.webp (1200×866) 62 KB
- project-photo-thumb.webp (400×288) 11 KB
+ ## Inspect, prepare and publish
- Social (resized-social/):
- project-photo-social-square.webp (1080×1080) 74 KB
- project-photo-social-portrait.webp (1080×1350) 91 KB
- project-photo-social-landscape.webp (1200×675) 65 KB
- project-photo-social-linkedin.webp (1200×627) 63 KB
+ Scan the authorized folder non-recursively for supported `.jpg`, `.jpeg`, `.png`, `.tif`, `.tiff` and `.webp` files; report the count and stop explicitly on no supported inputs. Inspect actual access, source membership and collision boundaries before processing. Preserve originals, names, unrelated files and source access metadata. Duplicate stems or existing reserved outputs block except a proven exact retry.
- Print (resized-print/):
- project-photo-arch-a.jpg (2700×1949) 959 KB
- project-photo-arch-b.jpg (3600×2599) 1698 KB
- project-photo-arch-c.jpg (5019×3623) 3470 KB
- ```
+ Follow the owner's complete-batch preparation and the [native mutation sequence](../../docs/workspace-model.md#native-mutation-sequence). Prepare every successful source's whole derivative group and any requested public report before the first publisher; failed sources contribute no partial derivative group and do not prevent preparing other sources. Durably finish, separately reopen and verify the entire retained original/prepared byte and access set. Publish complete files with no clobber; a direct public file creation followed by writing is insufficient. Reopen and inspect every actual image/report destination and access metadata, then the full protected/source set before completion. Reconcile interrupted or exact repeated work before making new copies.
- If any files failed, list them with their error messages.
+ ## Inspect and report results
- ## Edge Cases
+ Verify decoded dimensions, format, print 300×300 DPI and actual crop/orientation/color behavior. Inspect the images for material subject clipping; center crop has no subject detection. Web limits width, print fits an unrotated box, and both avoid enlargement. Small inputs still receive every selected labelled output; social/slides enlarge to fill. Non-RGB/L sources convert to RGB with alpha discarded, and animated/multipage sources contribute only their initial frame. Do not promise ICC/EXIF preservation, metadata stripping or automatic orientation correction.
- - **Social and slides crops** — center crop always; if a subject is off-center, the user should crop manually before running the skill
- - **Portrait images (web/print)** — aspect ratio is always preserved; the image fits within the target dimensions, so a portrait image will be narrower than the target width
- - **Images already smaller than the target** — web sizes: skip upscaling, save as-is with the size label; print sizes: save at original resolution with 300 DPI tag; social: upscale to fill (center crop still applies)
- - **RGBA / PNG with transparency** — convert to RGB before saving (JPEG and most social WebP don't support alpha)
- - **Duplicate filenames** — if two source files share a stem after stripping extension, the second will overwrite the first; warn the user if this happens
- - **Read errors** — catch and report per-file, continue processing the rest
+ List actual output directories, filenames, dimensions and integer KiB, successful/failed source counts and concrete errors/omissions. Keep the compatible mechanical summary separate from [actual completion evidence](../../docs/completion-reporting.md); partial batch success is not full completion. No record adoption, registration, upload or external delivery is implicit.