image-processing
jezweb/claude-skills
Resize, crop, convert, and optimize images for web—PNG/WebP/JPG, thumbnails, OG cards, powered by Pillow.
What is image-processing?
Image processing skill for web development using Pillow (Python). Handles resizing, format conversion, whitespace trimming, compression, thumbnail generation, and OG card creation. Use when you need to prepare images for production or optimize file sizes without ImageMagick.
- Resize images with aspect ratio preservation using LANCZOS resampling
- Convert between PNG, WebP, JPG formats with format-specific quality settings
- Trim whitespace and auto-crop logos and icons
- Generate thumbnails that fit within max dimensions
- Optimize images for web with compression and max-width constraints
- Create Open Graph card images (1200×630) with text overlays and backgrounds
How to install image-processing
npx skills add https://github.com/jezweb/claude-skills --skill image-processing- Python with Pillow installed (pip install Pillow)
- Alternatively: sips (macOS built-in), sharp (Node.js), or ffmpeg (cross-platform)
How to use image-processing
- 1.Install the skill and ensure Pillow is available (pip install Pillow)
- 2.Use img-process CLI for standard operations: resize, convert, trim, thumbnail, optimise, og-card, or batch
- 3.For standard operations, run commands like: img-process resize image.png --width 1920 or img-process convert logo.png --format webp
- 4.For complex workflows (compositing, watermarks, conditional logic), generate a custom Pillow script adapted to your needs
- 5.Check output format guide: WebP for photos, PNG for logos with transparency, JPG for fallback
Use cases
- Prepare hero images for production by resizing to 1920px and converting to WebP
- Clean up client-supplied logos with white backgrounds and generate multiple favicon sizes
- Batch convert a folder of PNGs to WebP for faster web delivery
- Generate OG card images with custom titles and subtitles for social sharing
- Optimize generated images from Gemini Image Gen skill for production use
- Web developers optimizing image assets
- Frontend engineers preparing images for production
- Designers automating image batch processing
- Full-stack developers building image generation pipelines
image-processing FAQ
Use img-process CLI for standard operations (resize, convert, trim, thumbnail, optimise, OG card, batch). Generate a custom script only when you need logic img-process doesn't cover, like compositing multiple images, watermarks, or complex text layouts.
Use WebP for photos and hero images (best compression), PNG for logos and icons needing transparency (lossless), JPG for fallback support in older browsers, and PNG for OG cards (social platforms handle PNG best).
JPG doesn't support transparency, so composite the RGBA image onto a white background first before saving as JPG. The skill handles this automatically in the save_image pattern.
Yes, use img-process batch command: img-process batch ./images --action convert --format webp -o ./optimised to process all images in a folder with the same operation.
Use alternatives: sips (macOS built-in, limited features), sharp (Node.js, full feature set), or ffmpeg (cross-platform, good for resize/convert).
Full instructions (SKILL.md)
Source of truth, from jezweb/claude-skills.
name: image-processing description: "Process images for web development — resize, crop, trim whitespace, convert formats (PNG/WebP/JPG), optimise file size, generate thumbnails, create OG card images. Uses Pillow (Python) — no ImageMagick needed. Trigger with 'resize image', 'convert to webp', 'trim logo', 'optimise images', 'make thumbnail', 'create OG image', 'crop whitespace', 'process image', or 'image too large'." compatibility: claude-code-only
Image Processing
Use img-process (shipped in bin/) for common operations. For complex or custom workflows, generate a Pillow script adapted to the user's environment.
Quick Reference — img-process CLI
img-process resize hero.png --width 1920
img-process convert logo.png --format webp
img-process trim logo-raw.jpg -o logo-clean.png --padding 10
img-process thumbnail photo.jpg --size 200
img-process optimise hero.jpg --quality 85 --max-width 1920
img-process og-card -o og.png --title "My App" --subtitle "Built for speed"
img-process batch ./images --action convert --format webp -o ./optimised
Use img-process when: the operation is standard (resize, convert, trim, thumbnail, optimise, OG card, batch). This is faster and avoids generating a script each time.
Generate a custom script when: the operation needs logic img-process doesn't cover (compositing multiple images, watermarks, complex text layouts, conditional processing).
Prerequisites
Pillow is required for both img-process and custom scripts:
pip install Pillow
If Pillow is unavailable, use alternatives:
| Alternative | Platform | Install | Best for |
|---|---|---|---|
sips | macOS (built-in) | None | Resize, convert (no trim/OG) |
sharp | Node.js | npm install sharp | Full feature set, high performance |
ffmpeg | Cross-platform | brew install ffmpeg | Resize, convert |
Output Format Guide
| Use case | Format | Why |
|---|---|---|
| Photos, hero images | WebP | Best compression, wide browser support |
| Logos, icons (need transparency) | PNG | Lossless, supports alpha |
| Fallback for older browsers | JPG | Universal support |
| Thumbnails | WebP or JPG | Small file size priority |
| OG cards | PNG | Social platforms handle PNG best |
Core Patterns
Save with Format-Specific Quality
Different formats need different save parameters. Always handle RGBA-to-JPG compositing — JPG does not support transparency, so composite onto a white background first.
from PIL import Image
import os
def save_image(img, output_path, quality=None):
os.makedirs(os.path.dirname(output_path) or ".", exist_ok=True)
kwargs = {}
ext = output_path.lower().rsplit(".", 1)[-1]
if ext == "webp":
kwargs = {"quality": quality or 85, "method": 6}
elif ext in ("jpg", "jpeg"):
kwargs = {"quality": quality or 90, "optimize": True}
# RGBA → RGB: composite onto white background
if img.mode == "RGBA":
bg = Image.new("RGB", img.size, (255, 255, 255))
bg.paste(img, mask=img.split()[3])
img = bg
elif ext == "png":
kwargs = {"optimize": True}
img.save(output_path, **kwargs)
Resize with Aspect Ratio
When only width or height is given, calculate the other from aspect ratio. Use Image.LANCZOS for high-quality downscaling.
def resize_image(img, width=None, height=None):
if width and height:
return img.resize((width, height), Image.LANCZOS)
elif width:
ratio = width / img.width
return img.resize((width, int(img.height * ratio)), Image.LANCZOS)
elif height:
ratio = height / img.height
return img.resize((int(img.width * ratio), height), Image.LANCZOS)
return img
Trim Whitespace (Auto-Crop)
Remove surrounding whitespace from logos and icons. Convert to RGBA first, then use getbbox() to find content bounds.
img = Image.open(input_path)
if img.mode != "RGBA":
img = img.convert("RGBA")
bbox = img.getbbox() # Bounding box of non-zero pixels
if bbox:
img = img.crop(bbox)
Thumbnail
Fit within max dimensions while maintaining aspect ratio:
img.thumbnail((size, size), Image.LANCZOS)
Optimise for Web
Resize + compress in one step. Convert to WebP for best compression. Typical settings: width 1920, quality 85.
Cross-Platform Font Discovery
System font paths differ by OS. Try multiple paths, fall back to Pillow's default. On Linux, fc-list can discover fonts dynamically.
from PIL import ImageFont
def get_font(size):
font_paths = [
# macOS
"/System/Library/Fonts/Helvetica.ttc",
"/System/Library/Fonts/SFNSText.ttf",
# Linux
"/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
"/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf",
# Windows
"C:/Windows/Fonts/arial.ttf",
]
for path in font_paths:
if os.path.exists(path):
try:
return ImageFont.truetype(path, size)
except Exception:
continue
return ImageFont.load_default()
OG Card Generation (1200x630)
Composite text on a background image or solid colour. Apply semi-transparent overlay for text readability. Centre text horizontally.
from PIL import Image, ImageDraw, ImageFont
width, height = 1200, 630
# Background: image or solid colour
if background_path:
img = Image.open(background_path).resize((width, height), Image.LANCZOS)
else:
img = Image.new("RGB", (width, height), bg_color or "#1a1a2e")
# Semi-transparent overlay for text readability
overlay = Image.new("RGBA", (width, height), (0, 0, 0, 128))
img = img.convert("RGBA")
img = Image.alpha_composite(img, overlay)
draw = ImageDraw.Draw(img)
font_title = get_font(48)
font_sub = get_font(24)
# Centre title
if title:
bbox = draw.textbbox((0, 0), title, font=font_title)
tw = bbox[2] - bbox[0]
draw.text(((width - tw) // 2, height // 2 - 60), title, fill="white", font=font_title)
img = img.convert("RGB")
Common Workflows
Logo Cleanup (client-supplied JPG with white background)
img-process trim logo-raw.jpg -o logo-trimmed.png --padding 10
img-process thumbnail logo-trimmed.png --size 512 -o favicon-512.png
Prepare Hero Image for Production
img-process optimise hero.jpg --max-width 1920 --quality 85
# Outputs hero.webp — resized and compressed
Batch Process
img-process batch ./raw-images --action convert --format webp --quality 85 -o ./optimised
img-process batch ./photos --action resize --width 800 -o ./thumbnails
Pipeline with Gemini Image Gen
Generate images with the gemini-image-gen skill, then process them:
# After generating with Gemini (raw PNG output):
img-process optimise generated-image.png --max-width 1920 --quality 85
# Or batch process all generated images:
img-process batch ./generated --action optimise -o ./production
Related skills
More from jezweb/claude-skills and the wider catalog.

landing-page
Generate a complete, deployable landing page from a brief. Produces a single self-contained HTML file with Tailwind CSS (via CDN), responsive design, dark mode, semantic HTML, and OG meta tags. Sections: hero with CTA, features, social proof, pricing (optional), FAQ, footer. Use when building a marketing page, product launch page, coming soon page, or any standalone landing page. Triggers: 'landing page', 'create a page', 'marketing page', 'launch page', 'coming soon page', 'one-page site'.

mcp-builder
Build MCP servers in Python with FastMCP. Define tools / resources / prompts, build the server, test locally, deploy to FastMCP Cloud or Docker. Use whenever the user mentions building an MCP server, exposing tools to LLMs, FastMCP, building a Claude integration, or troubleshooting FastMCP module-level server, storage, lifespan, middleware, OAuth, or deployment errors.

motion
|

nemoclaw-setup
Install and configure NVIDIA NemoClaw (sandboxed OpenClaw agent platform) on Linux. Handles cloudflared tunnels, Docker cgroup fixes, OpenShell, sandbox creation, remote access via Cloudflare Tunnel, and known bug workarounds. Use whenever the user mentions installing NemoClaw, setting up OpenClaw, configuring an NVIDIA Spark or DGX for sandboxed agents, or troubleshooting NemoClaw deployment.

nextjs
|

nz-business-english
New Zealand business English writing style for professional communications — warm, inclusive, EN-NZ spelling (colour, organise, centre). Use whenever the user is writing for a New Zealand audience: emails, chat messages, proposals, client communications, blog posts, web copy, or any business writing. Apply to drafting, editing, and tone-checking professional text.