计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
image-core【效率与协作】Create, open, inspect, transform, composite, resize, crop, convert, enhance, filter, and validate ordinary Pillow Image workflows.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when an agent needs day-to-day PIL.Image.Image workflows: construct or open images, inspect dimensions and modes, crop/paste/resize/thumbnail, convert modes, preserve alpha, composite layers, apply core ImageOps, ImageChops, ImageEnhance, ImageFilter, and compute basic ImageStat metrics.
Image.open(), understand lazy loading, and safely copy or load images before closing files.Image.new(), use pixel boxes and Pillow's coordinate conventions, and debug crop/paste geometry.BytesIO input/output, basic save() calls, decompression-bomb guardrails, and common errors like UnidentifiedImageError or invalid crop boxes.formats-and-metadata.drawing-and-text.plugins-and-extension.references/api-reference.md summarizes the core API surface, signatures, modes, coordinate boxes, and module roles.references/workflows.md gives copy-pasteable image pipelines for open/inspect, crop/paste, alpha-preserving logos, resizing, filtering, and BytesIO.references/troubleshooting.md maps common failures to fixes and guardrails.scripts/inspect_image.py is a small installed-Pillow-only helper for identifying images and optionally writing thumbnails.from PIL import Image, ImageOps
with Image.open(input_path) as im:
im = ImageOps.exif_transpose(im) # if metadata-aware orientation is desired
work = im.convert("RGBA")
thumb = ImageOps.contain(work, (512, 512))
thumb.save(output_path, format="PNG")
from PIL import Image
base = Image.new("RGBA", (400, 300), (255, 255, 255, 0))
logo = Image.open(logo_path).convert("RGBA")
base.alpha_composite(logo, dest=(20, 20))
base.save(output_path, "PNG")
load(), copy(), or all needed pixel operations are complete; Image.open() reads headers lazily.(left, upper, right, lower) with right/lower exclusive; validate right > left, lower > upper, and expected size before paste().thumbnail() only when in-place mutation is wanted; use resize(), ImageOps.contain(), fit(), or pad() when a new image is clearer.RGBA before resizing, filtering, or compositing; flatten intentionally before saving to formats without alpha.NEAREST for masks/pixel art, BICUBIC as a balanced default, LANCZOS for high-quality downscaling.