Pillow
Python imaging library (fork of PIL) for opening, manipulating, and saving a wide range of image formats with a simple, well-established API.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Historically had image-parsing CVEs (WebP, TIFF decoders); keep Pillow pinned to latest patch release. Validate image dimensions and file size before processing untrusted input.
⚡ Reliability
Best When
You need a straightforward, dependency-light Python library for common image operations in scripts, notebooks, or moderate-volume server workflows.
Avoid When
You need sub-100ms image transforms at high concurrency or require advanced computer vision capabilities beyond basic manipulation.
Use Cases
- • Open and convert images between formats (JPEG, PNG, GIF, TIFF, BMP, WebP) in data ingestion pipelines
- • Resize and crop images to target dimensions before feeding them to vision model APIs
- • Annotate images with text, shapes, or bounding boxes using the ImageDraw module for visualization output
- • Extract and read EXIF metadata (GPS coordinates, camera model, capture time) from JPEG photos
- • Apply mode conversions (RGB to grayscale, RGBA to RGB with composited background) for preprocessing
Not For
- • High-throughput production image pipelines where performance is critical (use Sharp or libvips instead)
- • Computer vision tasks like object detection, feature matching, or optical flow (use OpenCV)
- • Multi-threaded image processing — some Pillow operations release and re-acquire the GIL inconsistently
Interface
Authentication
Library — no authentication required.
Pricing
HPND (Historical Permission Notice and Disclaimer) license — permissive and business-friendly.
Agent Metadata
Known Gotchas
- ⚠ Image.open() is lazy — the file is not fully read until an operation forces decoding; always call .load() or wrap in a context manager to ensure the file handle is properly released.
- ⚠ Pillow loads images in the mode they were saved (e.g., RGBA, P, L); agents must explicitly convert to RGB with .convert('RGB') before passing pixel data to most ML models.
- ⚠ DecompressionBombWarning (and error for very large images) is triggered by default for images above ~178 million pixels; set Image.MAX_IMAGE_PIXELS = None only in controlled environments.
- ⚠ EXIF orientation is NOT automatically applied on open — images may appear rotated; use ImageOps.exif_transpose() explicitly to correct orientation before processing.
- ⚠ Some operations (paste, composite, certain filters) are not thread-safe due to internal C extension state; use multiprocessing instead of threading for parallel image processing.
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Pillow.
Scores are editorial opinions as of 2026-03-06.