Independent · every example tested on Pillow 12.3.0

Pillow (PIL) for Python
Tested fixes, guides & tools.

Practical answers for working with images in Python: install Pillow, fix the errors everyone hits, and resize, crop, convert, draw and batch-process images. Every code example is run against real Pillow before it is published, and the output shown is what it printed.

$ python -m pip install pillow

Not the official Pillow site. Official docs: pillow.readthedocs.io

edit.py
Real output
Original: the Artemis II rocket on Launch Pad 39B at sunset The same photo after the Pillow code below Pillow outputOriginal
from PIL import Image, ImageEnhance

img = Image.open("photo.jpg")
img = ImageEnhance.Color(img).enhance(1.8)
img = ImageEnhance.Contrast(img).enhance(1.25)
img.save("result.jpg")

Photo: NASA/Sam Lott, public domain. Images produced by the code shown, with Pillow 12.3.0.

Start here: the most common Pillow problems

Each page reproduces the problem on Pillow 12.3.0, explains why it happens, and shows the fix with real output.

Build a Pillow script, then run it here

Tick the steps you need. The script updates as you go; Run executes it with real Pillow in your browser (Pyodide) on a sample photo. All 1,042 combinations of these options are run against Pillow 12.3.0 when the site is built.

Steps
pipeline.py
from PIL import Image, ImageDraw, ImageEnhance, ImageOps

img = Image.open("phone.jpg")

# Fix phone-photo rotation (EXIF)
img = ImageOps.exif_transpose(img)

# Shrink to fit 800×800
img.thumbnail((800, 800), Image.LANCZOS)

# More contrast
img = ImageEnhance.Contrast(img).enhance(1.4)

# Add a caption
draw = ImageDraw.Draw(img)
draw.text((img.width // 2, img.height - 20), "Launch Pad 39B", fill="white", anchor="ms",
          font_size=max(16, img.width // 18), stroke_width=2, stroke_fill="black")

img.save("result.jpg", quality=85, optimize=True)
print("saved result.jpg:", img.size, img.mode)
First run downloads Python and Pillow (about 12 MB); nothing is uploaded.

Every guide and error fix

Grouped by what you are trying to do. Guides explain a task; error pages start from the exact message you see.

Browser tools that write Pillow code

Utilities that generate Pillow code from a live preview. They run locally in your browser; your images are not uploaded.

All tools

How the examples are tested

43tested pages (27 guides, 16 error fixes)
290code examples run before publishing
3operating systems in CI: Linux, Windows, macOS
251examples you can run in your browser

A script runs every example on Pillow 12.3.0 and Python 3.13 in a clean folder with the same sample files, and writes the output into the page. Continuous integration repeats this on Linux, Windows, macOS, and against the newest Pillow release, so pages show where behaviour differs between systems and are flagged when a release changes it. Examples that reproduce errors from older installs run on Pillow 9.0.1. The photos are public-domain NASA images. About the site and how we test.

Frequently asked questions

Is this the official Pillow website?

No. Pillow Python is an independent site. The official documentation is at pillow.readthedocs.io, and the project lives on GitHub. We are not affiliated with it.

What is the difference between PIL and Pillow?

PIL, the Python Imaging Library, stopped at version 1.1.7 in 2009 and never supported Python 3. Pillow is its maintained fork. You install pillow and import PIL: from PIL import Image.

How are the examples tested?

Every example is run by a script against a real Pillow installation before the page is published, and the output you see is what it printed. A scheduled job re-runs them on Linux, Windows and macOS and against each new Pillow release. More on how we test.

Which Pillow version do I have?

Run python -c "import PIL; print(PIL.__version__)" with the Python that runs your code. The install guide shows how to upgrade, and which Pillow supports which Python.

Do the Run buttons upload my code or images?

No. They run Pillow inside your browser with Pyodide (Python compiled to WebAssembly). Nothing is sent to a server; the first run downloads about 12 MB of Python and Pillow from a public CDN.