Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Pillow Pro

ASecurity

Automate image processing in Python with Pillow for resizing, watermarking, thumbnails, and batch pipelines.

2 stars
0 votes
0 copies
0 views
Added 9/29/2026
ai-agentspythongodebugging

Security Analysis

A100/100

Scanned 9/29/2026

$npx -y skills add aicodedecode/awesome-muse-skills --skill pillow-pro --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pillow Pro?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Pillow Pro
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aicodedecode-pillow-pro/badge)](https://www.skillsdirectory.com/skills/aicodedecode-pillow-pro)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: pillow-pro
description: Automate image processing in Python with Pillow for resizing, watermarking, thumbnails, and batch pipelines.
category: media
---

## Overview

Pillow (PIL) is Python's workhorse for programmatic image processing: resizing, cropping,
watermarking, format conversion, thumbnails, and batch pipelines. When you need to process hundreds
of images identically — or build image handling into an application — Pillow beats manual tools.
This skill covers practical Pillow patterns for real production tasks.

## When to use

- Batch resizing, converting, or watermarking images in Python

- Generating thumbnails and responsive image variants

- Compositing text/graphics onto images (memes, certificates, OG images)

- Building image pipelines in web apps or scripts

- Analyzing image properties (dimensions, mode, EXIF)

## Core concepts

- - **Open, transform, save.** The core loop: `Image.open()` → operations (chainable) → `save()`
  with format-specific options. Pillow is lazy — operations queue until save/show, and `open()`
  doesn't load pixel data until needed.
- - **Modes matter.** `RGB` (standard), `RGBA` (transparency), `L` (grayscale), `P` (palette).
  Compositing requires matching modes — convert explicitly (`img.convert("RGBA")`) rather than
  debugging cryptic errors.
- - **Resampling filters.** `Image.LANCZOS` for high-quality downscaling, `Image.BICUBIC` for
  general use, `Image.NEAREST` for pixel art (preserves hard edges). The default is fast but ugly —
  always specify.
- - **`thumbnail()` vs `resize()`.** `thumbnail()` modifies in place, preserves aspect ratio, never
  enlarges — perfect for preview generation. `resize()` gives exact dimensions (may distort) — use
  with computed aspect-preserving math.
- - **EXIF orientation.** Phone photos carry rotation in EXIF, not pixels.
  `ImageOps.exif_transpose(img)` applies it — skip this and portraits come out sideways. Do it
  first, always.
- - **Memory discipline.** Large batches: process one image at a time, explicitly `close()` or use
  context managers, and avoid holding all images in a list. A 1000-image batch that loads everything
  will OOM.

## Practical workflow

1. 1. **Set up the pipeline.** Input dir, output dir (never overwrite sources), consistent naming,
   and a log of what was processed. Pillow scripts should be idempotent — safe to re-run.
2. 2. **Normalize inputs.** Apply `exif_transpose`, convert to working mode (usually RGB/RGBA), and
   validate (catch corrupt files with try/except — real-world folders always contain one).
3. 3. **Apply transforms.** Resize/crop per spec. For aspect-safe crops: compute the target box from
   the center or use `ImageOps.fit(img, (w, h), Image.LANCZOS)` which crops-to-fill elegantly.
4. 4. **Composite overlays.** Watermarks: create an RGBA overlay layer, `alpha_composite` or `paste`
   with mask. Text: `ImageDraw` with a loaded TrueType font (`ImageFont.truetype`), computing text
   size with `draw.textbbox` for centering.
5. 5. **Optimize on save.** JPEG: `quality=82, optimize=True, progressive=True`. PNG:
   `optimize=True`. WebP: `quality=80, method=6`. Strip EXIF on save unless needed (`exif=b""` or
   omit).
6. 6. **Batch it.** Loop with progress reporting, error isolation per file (one bad image shouldn't
   kill the batch), and a summary at the end. Example skeleton:

```python
from PIL import Image, ImageOps
from pathlib import Path

SRC, DST = Path("input"), Path("output")
DST.mkdir(exist_ok=True)
for p in SRC.glob("*.jpg"):
    try:
        with Image.open(p) as im:
            im = ImageOps.exif_transpose(im).convert("RGB")
            im.thumbnail((1600, 1600), Image.LANCZOS)
            im.save(DST / p.with_suffix(".webp").name,
                    "WEBP", quality=80, method=6)
    except Exception as e:
        print(f"SKIP {p.name}: {e}")
```

7. 7. **Verify outputs.** Spot-check dimensions, file sizes, and visual quality. Check a few images
   at 100% — a wrong resample filter or quality setting poisons the whole batch silently.

## Common pitfalls

- - **Sideways phone photos.** Forgetting `exif_transpose` — the classic Pillow bug. It affects
  nearly every phone image; handle it unconditionally.
- - **Default resampling.** `resize()` without a filter uses NEAREST — blocky and ugly. Always pass
  `Image.LANCZOS` (downscale) explicitly.
- - **Mode mismatch errors.** Pasting RGBA onto RGB, or drawing on palette images. Convert to a
  common mode first; the error messages won't tell you plainly.
- - **Memory blowups.** Loading thousands of images into a list, or keeping references alive in a
  loop. Process streaming-style, one at a time.
- - **JPEG quality roulette.** Saving with default quality (75) when you wanted 90, or vice versa.
  Set quality deliberately per use case and document it.
- - **Overwriting sources.** Saving processed images back into the source folder with the same
  names. One bug away from destroying originals — always write to a separate output directory.

Attribution

aicodedecodeaicodedecode
View sourceSee grades on GitHubMore from aicodedecode →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →