# Pillow — card for AI agents

Python imaging library for image processing, manipulation and conversion.

Category: Files, images and media · PyPI package `pillow` · latest version 13.0.0 (checked 2026-11-01)
Install: `pip install pillow`
License: MIT-CMU (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## Pillow
- The PyPI project is `pillow` (pypi.org/project/pillow). The original PIL package on PyPI was declared abandoned by PyPI moderators in 2020 under PEP 541.
- On Pillow 12.3.0 or later, do not use non-image ImageCms modes. That release removed them.
- When editing Django code that uses `ImageField`, keep in mind that Django uses Pillow to validate and introspect the uploaded images.
- Report sensitive vulnerabilities privately through GitHub security advisories (github.com/python-pillow/Pillow/security/advisories/new). If GitHub is not an option, use the Tidelift security contact.
- Never put vulnerability details in a public issue, pull request or commit message.

## What it is
- Pillow is a fork of PIL, the Python Imaging Library by Fredrik Lundh. The README calls it "the friendly PIL fork by Jeffrey 'Alex' Clark and contributors". The website says it lets you open, edit and save many image file formats "with a simple, well-documented API." The GitHub repository was created on 2012-07-24. The latest release is 12.3.0.
- The README gives the design in a few lines. The library offers "extensive file format support" and "an efficient internal representation". Its core is built for fast access to data stored in a few basic pixel formats. The maintainers write that it "should provide a solid foundation for a general image processing tool."
- It is for Python code that has to read, change or write images. The website names Django, Wagtail, Home Assistant and Matplotlib as open source projects that rely on it for image processing.

## Caveats
- Five named people, all volunteers: The site lists Jeffrey 'Alex' Clark as founder and maintainer, three core maintainers and a sponsorship coordinator. It says the work happens in their spare time and asks businesses that rely on Pillow to sponsor it.
- No license in these sources: GitHub's repository metadata reports the license as None. None of the other pages here names one either. Confirm the license yourself before you ship.
- 12.3.0 drops ImageCms modes: Release 12.3.0 has a Removals section that removes non-image ImageCms modes. Code that relied on those modes needs changes before it can move to this version.

## Numbers (AgentGid data)
- Gid Score: 81.8 (#73 of all tools, 3 of 281 in its category)
- Used in 239 public projects set up for AI coding agents (3.8%)
- Downloads last week: 162,458,184 (as of 2026-11-24), +22.6% over 4 weeks
- GitHub stars: 14,010 (as of 2026-11-24)
- Last push: 2026-11-24

## Often used with
python-dotenv 45.6%, Pydantic 43.5%, Uvicorn 43.5%, NumPy 42.3%, Requests 40.6%, FastAPI 38.9%

## Checked alternatives (same job)
- OpenCV Python: https://agentgid.com/tools/opencv-python/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/pillow/
- Homepage: https://python-pillow.org
- Repository: https://github.com/python-pillow/Pillow
- Source: https://github.com/python-pillow/Pillow#readme
- Source: https://github.com/python-pillow/Pillow
- Source: https://github.com/python-pillow/Pillow/releases
- Source: https://python-pillow.org


## Pillow: resize, crop and convert pictures in Python

Pillow is a free Python library for working with pictures. Your app can open a photo someone uploads, turn it upright, make a small preview and crop a square avatar. It can also draw text on it and save it as JPEG, PNG or WebP. It is the maintained successor of the old PIL library, so code still says "from PIL import Image".

### Where to use it
- Previews of uploaded photos: A shop or blog lets people upload big phone photos; your app keeps a small copy for lists and galleries so pages load fast.
- Square avatars from any photo: New users upload a photo of any shape; your app cuts a centred square and saves it at one fixed size for profile pictures.
- Smaller files in WebP: Turn the JPEG and PNG pictures of a site into WebP files that weigh less, for example during a build or right after upload.
- Text and shapes on pictures: Write a title on a share picture, put a small mark in the corner of photos, or draw a simple badge for each user.
- Read photos straight from memory: Your web app gets the uploaded file as bytes and opens it without saving it to disk first.
- Strip location data before publishing: Photos from phones can carry the place and time they were taken; your app saves a clean copy before it shows the photo to others. (idea, not from the official pages)

### How to start
- Install Pillow into your project's Python environment (Python 3.11 or newer for Pillow 13).

```
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow
```

- Open a picture. The import name is PIL, not pillow.

```
from PIL import Image
im = Image.open("hopper.ppm")
```

- Make a thumbnail that keeps the picture's shape.

### License
Free to use, also in paid and closed-source products, under the MIT-CMU license. Keep the copyright and license notice with copies you ship, and do not use the original authors' names in your advertising.

### Good to know
- Pillow 13 needs Python 3.11 or newer; support for Python 3.10 was dropped in this release.
- Pictures from strangers are the main risk. The docs ask you to accept only the file types you need.
- Very large pictures trigger a warning, and pictures over twice the limit stop with an error. This protects your server from files built to eat all its memory.
- The project releases often; version 13.0.0 came out on 16 October 2026 and fixed many security problems. Keep it up to date.
- Pillow guesses the file type from the file's first bytes, not from its name, so a file called photo.png may be read as another type.

Checked 2026-11-11 against: https://github.com/python-pillow/Pillow/blob/main/README.md, https://github.com/python-pillow/Pillow/blob/main/LICENSE, https://pypi.org/pypi/pillow/json, https://pillow.readthedocs.io/en/stable/, https://pillow.readthedocs.io/en/stable/about.html, https://pillow.readthedocs.io/en/stable/installation/basic-installation.html, https://pillow.readthedocs.io/en/stable/installation/python-support.html, https://pillow.readthedocs.io/en/stable/handbook/tutorial.html, https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html, https://pillow.readthedocs.io/en/stable/handbook/security.html, https://pillow.readthedocs.io/en/stable/reference/Image.html, https://pillow.readthedocs.io/en/stable/reference/ImageOps.html, https://pillow.readthedocs.io/en/stable/reference/ImageDraw.html, https://pillow.readthedocs.io/en/stable/releasenotes/13.0.0.html, https://pillow.readthedocs.io/en/stable/deprecations.html

### Mistakes to avoid
- Don't: pip install PIL, or import Image → Do: pip install pillow==13.0.0, then from PIL import Image (The package is called pillow but its import name stays PIL; the old PIL project on PyPI is not updated.)
- Don't: im.resize(size, Image.ANTIALIAS) from old tutorials → Do: im.resize(size, Image.Resampling.LANCZOS) (or Image.LANCZOS) (ANTIALIAS, LINEAR and CUBIC were removed in Pillow 10; in our run on 13.0.0 Image.ANTIALIAS raised AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'.)
- Don't: draw.textsize(text, font) or font.getsize(text) → Do: draw.textbbox((0, 0), text, font=font) or font.getbbox(text) / font.getlength(text) (The old text measuring functions were removed; code copied from older answers stops with AttributeError.)
- Don't: Making a thumbnail of a phone photo straight after Image.open → Do: Call ImageOps.exif_transpose(im) first, then thumbnail or fit (Phones store many photos sideways with a turn tag; in our run the same upload gave a sideways 187x300 thumbnail without it and an upright 300x188 one with it.)
- Don't: Image.MAX_IMAGE_PIXELS = None to silence the size warning on a server → Do: Keep the limit, open uploads with formats=[...] and a file size limit, and treat DecompressionBombWarning as an error (The limit is what stops a small file that unpacks into gigabytes from taking down the server.)

### Questions
- Do I install "PIL" or "pillow"? Install pillow and import PIL. The old PIL project has had no release since 2009, and the Pillow team does not plan to update it.
- Can I use it in a paid app? Yes. The MIT-CMU license allows any use without a fee as long as the copyright notice stays with copies.
- Can it save AVIF? Yes. Pillow reads and writes AVIF, but saved AVIF files are 8-bit only.
- Does Image.open read the whole picture at once? No. It reads the header first and decodes the pixels only when you use them, so you can check size and type cheaply.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
