npx skills add ...
npx skills add jezweb/claude-skills --skill image-processing
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'.
npx skills add jezweb/claude-skills --skill 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.
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).
Pillow is required for both img-process and custom scripts:
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 |
| 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 |
Different formats need different save parameters. Always handle RGBA-to-JPG compositing — JPG does not support transparency, so composite onto a white background first.
When only width or height is given, calculate the other from aspect ratio. Use Image.LANCZOS for high-quality downscaling.
Remove surrounding whitespace from logos and icons. Convert to RGBA first, then use getbbox() to find content bounds.
Fit within max dimensions while maintaining aspect ratio:
Resize + compress in one step. Convert to WebP for best compression. Typical settings: width 1920, quality 85.
System font paths differ by OS. Try multiple paths, fall back to Pillow's default. On Linux, fc-list can discover fonts dynamically.
Composite text on a background image or solid colour. Apply semi-transparent overlay for text readability. Centre text horizontally.
Generate images with the gemini-image-gen skill, then process them: