Skip to content
Back to skills

Pillow

ASecurity

"Use this repo skill when working with Pillow (PIL fork) image

  • 247 stars
  • 0 votes
  • 0 copies
  • 12 views
  • Added September 8, 2026
businesspythonrustgoapi

Works with

  • api

Security analysis

A100/100

Pro scans all 20 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill pillow --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pillow?

Add the live security badge to your README. It updates with every re-scan.

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

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

Download with Pro
SKILL.md
---
name: pillow
description: "Use this repo skill when working with Pillow (PIL fork) image
  processing: opening/saving images, transforms, formats, metadata,
  drawing/text, fonts, and custom image plugins."
disable-model-invocation: true
metadata:
  disco-role: operating
license: NOASSERTION
---

# Pillow

Use this skill when an agent needs to write, debug, or explain Pillow code for image processing in Python. Pillow imports as `PIL` and centers on `PIL.Image.Image` objects created by `Image.open()` or `Image.new()`.

## Quick Start

```python
from PIL import Image, ImageOps

with Image.open("input.jpg") as im:
    im = ImageOps.exif_transpose(im)
    out = ImageOps.contain(im.convert("RGB"), (1024, 1024))
    out.save("output.jpg", quality=90)
```

Minimal import and feature check:

```python
from PIL import Image, features
print(Image.__version__)
print(features.check("jpg"), features.check("zlib"), features.check("webp"))
```

Use `python -m PIL` for Pillow's installed feature report. Run [`scripts/pillow_smoke_check.py`](scripts/pillow_smoke_check.py) when you need a safe in-memory check of imports, feature flags, open/save, drawing, and format registration.

## Route by Task

| User request | Go to |
| --- | --- |
| Open images, inspect size/mode, crop, paste, resize, thumbnail, convert modes, preserve alpha, composite, filter, enhance, use `BytesIO` | [`image-core`](sub-skills/image-core/SKILL.md) |
| Choose PNG/JPEG/GIF/TIFF/WebP/AVIF/JPEG2000/PDF/EPS behavior, preserve EXIF/ICC/XMP, handle animations or multi-page files, check codecs | [`formats-and-metadata`](sub-skills/formats-and-metadata/SKILL.md) |
| Draw lines/shapes, render text, use anchors, fonts, strokes, multiline layout, direction/language/OpenType features, watermarks | [`drawing-and-text`](sub-skills/drawing-and-text/SKILL.md) |
| Write or debug a custom `ImagePlugin`, register formats/extensions, inspect `PIL.features`, use `python -m PIL` plugin reports | [`plugins-and-extension`](sub-skills/plugins-and-extension/SKILL.md) |

## Shared References

- [`references/installation-and-features.md`](references/installation-and-features.md) explains public installation choices, source-build libraries, optional features, and feature-report commands.
- [`references/troubleshooting.md`](references/troubleshooting.md) covers cross-cutting install/import/build, codec, file lifecycle, and API misuse failures.
- [`references/repo-provenance.md`](references/repo-provenance.md) records the repository snapshot and evidence baseline used to generate this skill.

## General Decision Rules

- Use `Image.open(fp, mode="r", formats=None)` for input; it identifies images from file contents and reads image data lazily.
- Keep source files open until the image is loaded, copied, or all lazy frame access is complete.
- Pass `format="PNG"`, `format="JPEG"`, etc. when saving to file-like objects or extensionless paths.
- Carry metadata explicitly across transforms: EXIF, ICC, XMP, palettes, durations, loops, and TIFF tags do not automatically survive every copy/convert/resize path.
- Convert modes intentionally before saving: JPEG cannot store alpha, palette transparency is format-specific, and many operations are simpler in `RGB` or `RGBA`.
- Check optional features before promising a codec or text-layout behavior; compiled libraries vary across Pillow builds.

## Useful Bundled Scripts

- [`scripts/pillow_smoke_check.py`](scripts/pillow_smoke_check.py): safe in-memory sanity check for installed Pillow.
- [`sub-skills/image-core/scripts/inspect_image.py`](sub-skills/image-core/scripts/inspect_image.py): inspect an input image and optionally write a thumbnail.
- [`sub-skills/formats-and-metadata/scripts/format_capability_report.py`](sub-skills/formats-and-metadata/scripts/format_capability_report.py): report feature and registered-format support.
- [`sub-skills/drawing-and-text/scripts/render_text_anchor_grid.py`](sub-skills/drawing-and-text/scripts/render_text_anchor_grid.py): render a text-anchor grid for the current installation.
- [`sub-skills/plugins-and-extension/scripts/minimal_spam_plugin.py`](sub-skills/plugins-and-extension/scripts/minimal_spam_plugin.py): self-test a minimal custom Pillow plugin.

## When to Be Careful

- `Image.open()` can raise `UnidentifiedImageError` or `OSError`; do not catch every exception silently unless scanning many files.
- Large or hostile files can trigger `DecompressionBombWarning` or `DecompressionBombError`; set policy before batch processing untrusted inputs.
- `thumbnail()` mutates in place; `resize()`, `ImageOps.contain()`, `ImageOps.fit()`, and `ImageOps.pad()` return new images.
- Boxes are `(left, upper, right, lower)` with right/lower exclusive. Validate geometry before `crop()` and `paste()`.
- `direction`, OpenType `features`, and `language` in text rendering need libraqm support; provide fallbacks when unavailable.
- Custom plugins must be imported before `Image.open()` can dispatch to them.

Files in this skill

  • SKILL.md4.9 KB
  • references/installation-and-features.md2.6 KB
  • references/repo-provenance.md2.2 KB
  • references/repo-routing-metadata.json318 B
  • references/troubleshooting.md3.5 KB
  • scripts/pillow_smoke_check.py3.1 KB
  • sub-skills/drawing-and-text/SKILL.md5.5 KB
  • sub-skills/drawing-and-text/references/drawing-reference.md3.8 KB
  • sub-skills/drawing-and-text/references/text-and-fonts.md5.6 KB
  • sub-skills/drawing-and-text/references/troubleshooting.md4.8 KB
  • sub-skills/drawing-and-text/scripts/render_text_anchor_grid.py6.1 KB
  • sub-skills/formats-and-metadata/SKILL.md4.7 KB
  • sub-skills/formats-and-metadata/references/format-reference.md8 KB
  • sub-skills/formats-and-metadata/references/metadata-and-sequences.md7.2 KB
  • sub-skills/formats-and-metadata/references/troubleshooting.md6.8 KB
  • sub-skills/formats-and-metadata/scripts/format_capability_report.py4 KB
  • sub-skills/image-core/SKILL.md3.5 KB
  • sub-skills/image-core/references/api-reference.md7.7 KB
  • sub-skills/image-core/references/troubleshooting.md5.3 KB
  • sub-skills/image-core/references/workflows.md5.6 KB

Attribution

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

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.