Extensive Format Support
Seamlessly open, read, and write JPEG, PNG, WEBP, GIF, TIFF, BMP, ICO, PSD, and 25+ more formats. Batch-convert massive ML datasets with single-line format migrations.
Python Pillow is the industry standard for image processing in Python. Open, resize, filter, convert, draw, and analyze images with a clean, expressive API — all in pure Python.
Everything you need to manipulate local and remote images inside Python pipelines.
Seamlessly open, read, and write JPEG, PNG, WEBP, GIF, TIFF, BMP, ICO, PSD, and 25+ more formats. Batch-convert massive ML datasets with single-line format migrations.
Resize, crop, rotate, flip, and transpose images. Use high-quality Lanczos resampling to retain visual fidelity at any scale.
Apply BLUR, CONTOUR, SHARPEN, EDGE_ENHANCE, FIND_EDGES, EMBOSS, and custom kernel filters via the ImageFilter module.
Draw polygons, arcs, rectangles, and overlay TrueType/OpenType text with ImageDraw. Automate watermarks, captions, and thumbnail overlays at scale.
Pillow's power comes from its modular design. Each module handles a distinct area of image processing.
The central class. Open, create, save, convert, resize, and transform images. Every pipeline starts here.
open()save()resize()crop()convert()
Draw 2D graphics onto images. Supports lines, rectangles, ellipses, polygons, and text rendering.
line()rectangle()ellipse()text()
Pre-built filters including GaussianBlur, UnsharpMask, MedianFilter, and custom kernel convolutions.
GaussianBlurSHARPENEDGE_ENHANCE
Adjust Brightness, Contrast, Color saturation, and Sharpness using a simple factor-based API.
BrightnessContrastColorSharpness
High-level operations: autocontrast, equalize, flip, grayscale, pad, fit, contain, and invert.
autocontrast()equalize()fit()grayscale()
Load TrueType (TTF) and OpenType (OTF) fonts for high-quality text rendering in generated images.
truetype()load_default()getbbox()
Channel operations: add, subtract, multiply, difference, composite — pixel-level arithmetic between images.
add()multiply()difference()
Compute statistics (mean, median, RMS, standard deviation, extrema) over entire images or pixel bands.
meanmedianrmsextrema
Zero to processing in minutes. Select your operating system below.
Windows supplies pre-compiled binary wheels — no Visual Studio required. Run in PowerShell.
Open the Python REPL and ensure PIL is detected successfully.
Pillow provides universal wheels for both Apple Silicon (M1/M2/M3) and Intel Macs.
Use Homebrew to add optional codec support before installing Pillow.
Install C libraries needed for full format support.
Install Pillow into your current Python environment.
For system-wide install without a virtual environment.
Recommended: keep your project dependencies isolated.
With the environment active, install Pillow normally.
Available in both the defaults and conda-forge channels.
Pillow integrates natively with Jupyter Notebook for inline image display.
All 30+ image formats supported across read, write, and animation dimensions.
The most frequently used Python instructions for daily image processing tasks.
Load an image and verify its size, mode, and format.
Resize preserving aspect ratio in-place.
Save heavy PNGs as highly compressed lossless WEBP.
Define a box tuple (left, upper, right, lower) to slice.
Blur, sharpen, find edges — one-line filter application.
Overlay text using ImageDraw and a loaded font.
Adjust brightness, contrast, color, or sharpness by a factor.
Extract camera metadata embedded in JPEG images.
Copy–paste solutions for the most common Pillow use cases. Every recipe is production-ready.
Resize every image in a folder to 800×600 max bounding box, preserving aspect ratio. Ideal for pre-processing ML datasets or web asset pipelines.
Overlay semi-transparent text or logo watermarks on every image in a directory. Uses composite blending for professional results.
Read camera metadata from JPEG photos: GPS coordinates, make/model, ISO, shutter speed, and focal length — decoded to human-readable values.
Programmatically create Open Graph / Twitter card images. Draw a gradient background, overlay your title text, and export as optimized JPEG.
Use getbbox() to automatically detect non-white/non-black borders and crop the image to its real content region.
Convert an entire directory of PNG files to space-efficient WEBP format. Typically reduces file size by 25–34% without visible quality loss.
Toggle the operations you need — copy a unified, ready-to-run processing pipeline.
Apply Pillow-equivalent effects instantly in your browser. Toggle filters and see the result in real time.
See how Pillow stacks up against other Python image processing libraries.
| Feature | Pillow ✅ | OpenCV | Wand (ImageMagick) | scikit-image | imageio |
|---|---|---|---|---|---|
| Pure Python API | ✅ Yes | ❌ C++ bindings | ❌ C bindings | ✅ Yes | ✅ Yes |
| Ease of Use | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ |
| Format Support | 30+ formats | ~20 formats | 200+ formats | ~15 formats | ~20 formats |
| pip install size | ~3 MB | ~50 MB | ~30 MB | ~20 MB | ~1 MB |
| Drawing / Text | ✅ ImageDraw | ✅ cv2.putText | ✅ Drawing | ❌ Limited | ❌ None |
| Thumbnail Generation | ✅ One line | ⚠️ Manual | ✅ Yes | ⚠️ Manual | ⚠️ Manual |
| ML / NumPy Integration | ✅ np.array(img) | ✅ Native arrays | ⚠️ Limited | ✅ Native | ✅ Arrays |
| License | MIT (HPND) | Apache 2.0 | MIT | BSD | BSD |
| Best For | General purpose | Computer vision | Complex transforms | Scientific analysis | I/O only |
The top developer pain points when working with Pillow — with exact solutions.
Cause: Pillow is not installed in the current Python environment.
Fix: Install via pip. The package is called Pillow but imports as PIL.
Cause: The file extension doesn't match the actual format, or the file is corrupt/truncated.
Fix: Verify the actual format and pass the explicit format parameter.
Cause: Pillow's security limit blocks images larger than 178 million pixels by default to prevent DoS attacks.
Fix: Raise or disable the limit (only for trusted sources).
Cause: Camera stores orientation in EXIF tag but Pillow does not auto-rotate on open.
Fix: Use ImageOps.exif_transpose() to apply EXIF rotation automatically.
Cause: JPEG does not support transparency (alpha channel). The image has 4 channels (RGBA) instead of 3 (RGB).
Fix: Convert to RGB before saving as JPEG, or use PNG for transparency.
Cause: Large images are loaded entirely into RAM before processing. A 100 MP TIFF can consume 1–2 GB uncompressed.
Fix: Use draft mode for loading, process in tiles, or downscale before processing.
Everything developers need to know about Pillow in Python.
Python Pillow is an open-source library that adds support for opening, manipulating, and saving many different image file formats. As the active fork of the original Python Imaging Library (PIL), Pillow is the foundational tool for image processing in Python — no complex C dependencies required for most operations.
PIL (Python Imaging Library) is the original, now-discontinued library that stopped supporting Python 3. Pillow is the actively maintained, drop-in compatible fork. It adds Python 3 support, security patches, new format support (WEBP, AVIF), and modern API improvements. You install Pillow but import it as PIL.
Run pip install Pillow. Even though the package is called Pillow, the import namespace is PIL for backward compatibility. Always use from PIL import Image in your code. If you're using a virtual environment, ensure it is activated first.
Run in Python: import PIL; print(PIL.__version__). Or from your terminal: python -m PIL which will print the version and feature support matrix. You can also run pip show Pillow from the command line.
Pillow supports 30+ formats including JPEG, PNG, WEBP, GIF (animated), TIFF, BMP, ICO, EPS, PSD (Adobe Photoshop), PDF reading, PPM, PCX, and more. Some formats like AVIF require optional system libraries. Use Image.registered_extensions() to see all available formats in your installation.
Yes. You can convert between Pillow Images and NumPy arrays easily: arr = numpy.array(img) to convert to array, and img = Image.fromarray(arr) to convert back. This makes Pillow ideal as a preprocessing layer before feeding images into PyTorch, TensorFlow, or scikit-learn models.
Yes. Use img.seek(frame_number) to iterate through GIF frames. To create an animated GIF, open all frames as a list and use img.save('output.gif', save_all=True, append_images=[...], duration=100, loop=0). Pillow can also read animated WEBP and TIFF files.
Pillow is implemented in C via libjpeg, zlib, and other native codecs — making it significantly faster than pure Python alternatives. For high-throughput pipelines, use img.draft() for JPEG draft loading, process multiple images with concurrent.futures.ThreadPoolExecutor, and use img.thumbnail() instead of img.resize() to avoid unnecessary upscaling.
WEBP is fully supported for reading, writing, and animated WEBP files. AVIF support was added in Pillow 9.1.0 but requires libavif to be installed on your system. To check: PIL.features.check('avif'). Modern binary wheels on PyPI include WEBP support out of the box.
Pillow uses the HPND (Historical Permission Notice and Disclaimer) license — a permissive open-source license similar to MIT. It is completely free for commercial use, closed-source projects, and any application. No attribution is required in your product, though credit is always appreciated by the community.