Pillow Python Documentation
Complete reference for Python Pillow 12.2.0 — the de facto standard imaging library for Python. Covers installation, the handbook tutorial, all core concepts, every module in the API, and real-world integration patterns.
Handbook & Tutorial
Start here. Covers opening images, saving, reading metadata, batch processing, and the most common operations.
Concepts
Understand Modes (RGB, RGBA, L, CMYK, HSV), Bands, Coordinate Systems, Filters, and how Pillow treats pixel data.
Image File Formats
JPEG, PNG, GIF, WEBP, BMP, TIFF, ICO, PDF and 30+ more. Read/write support matrix, parameters, and quirks.
Appendices
Filter reference, resampling algorithms (LANCZOS, BICUBIC, NEAREST), transpose operations, and color modes.
Image Module Reference
Complete API for Image.open(), Image.new(), save(), convert(), paste(), and all methods.
Integration Guide
Using Pillow with Django, FastAPI, Flask, NumPy, PyTorch, Tkinter, and Qt.
Quick Reference: All Modules
| Module | Purpose | Key Functions |
|---|---|---|
Image | Core image class — open, create, save, transform | open(), new(), save(), convert(), resize(), crop() |
ImageChops | Channel arithmetic operations (add, subtract, multiply) | add(), subtract(), multiply(), difference() |
ImageCms | ICC colour profile management | profileToProfile(), buildTransform() |
ImageColor | Parse CSS3 colour strings to tuples | getrgb(), getcolor() |
ImageDraw | 2D graphics drawing onto Image objects | line(), rectangle(), ellipse(), polygon(), text() |
ImageEnhance | Adjust sharpness, contrast, brightness, color | Contrast, Brightness, Sharpness, Color |
ImageFile | File loading helpers and parser base class | Parser, LOAD_TRUNCATED_IMAGES |
ImageFilter | Predefined and custom convolution filters | GaussianBlur, SHARPEN, UnsharpMask, Kernel |
ImageFont | TrueType/OpenType font loading for text drawing | truetype(), load(), load_default() |
ImageGrab | Screen capture and clipboard access | grab(), grabclipboard() |
ImageMath | Evaluate pixel-level math expressions | lambda_eval(), unsafe_eval() |
ImageMorph | Morphological operations on binary images | LutBuilder, MorphOp |
ImageOps | Ready-made image processing operations | autocontrast(), invert(), fit(), pad(), grayscale() |
ImagePalette | Colour palette management for 'P' mode images | ImagePalette() |
ImagePath | Geometric path storage and manipulation | Path(), getbbox(), transform() |
ImageSequence | Iterate over animation frames (GIF, WebP, TIFF) | Iterator() |
ImageStat | Per-band pixel statistics (mean, stddev, rms) | Stat(), .mean, .stddev, .rms |
ImageTransform | Affine, perspective, and mesh transforms | AffineTransform, PerspectiveTransform, MeshTransform |
ExifTags | Dictionary mapping EXIF tag IDs to human names | TAGS, GPSTAGS |
PixelAccess | Fast direct pixel read/write via img.load() | load(), [x, y] indexing |