Pillow
raw JSON → 12.1.1 verified Tue May 12 auth: no python install: verified quickstart: stale
Pillow is a Python Imaging Library (PIL) fork that adds image processing capabilities to Python. It supports extensive file formats and provides efficient internal representations. The current version is 12.1.1, released on February 11, 2026, with a regular release cadence.
pip install pillow Common errors
error ModuleNotFoundError: No module named 'PIL' ↓
cause This error occurs because the original Python Imaging Library (PIL) is outdated and has been superseded by Pillow. Developers often try to import the old 'PIL' package directly without installing Pillow, or they have Pillow installed but use an incorrect import statement.
fix
First, ensure Pillow is installed using
pip install Pillow. Then, import the Image module using from PIL import Image. error AttributeError: type object 'Image' has no attribute 'open' ↓
cause This typically happens due to a namespace conflict, often when another library (like `tkinter` with `from tkinter import *`) also defines an 'Image' object, masking Pillow's `Image` module. It can also occur if `Image.open` is incorrectly cased as `Image.Open`.
fix
To fix this, avoid global imports like
from tkinter import *. Instead, import specific components (e.g., import tkinter as tk) or explicitly import Image from Pillow as from PIL import Image and ensure correct casing (Image.open()). error PIL.UnidentifiedImageError: cannot identify image file ↓
cause This error means Pillow cannot recognize or open the specified image file. Common causes include an incorrect file path, a corrupted image file, an unsupported image format, or the file being locked by another process.
fix
Verify the image file path is correct and the file exists. Ensure the image is not corrupted and is in a supported format. If applicable, close any other applications or processes that might be holding the file open. For web sources, ensure the data stream is a valid image.
error OSError: cannot open resource ↓
cause This error frequently occurs when Pillow's `ImageFont.truetype()` function cannot locate the specified font file. This can be due to an incorrect font path, the font not being installed on the system, or permission issues preventing access to the font file.
fix
Provide the full, absolute path to the
.ttf or .otf font file. Ensure the font file exists at that location and that your program has read permissions. On some systems (like macOS), you might need to specify the exact system font directory. error SyntaxError: invalid syntax ↓
cause This error typically appears when a shell command like `pip install pillow` is executed inside the Python interactive interpreter (where you see `>>>` or `In [1]:`), instead of being run directly in the system's terminal or command prompt.
fix
Exit the Python interpreter by typing
exit() or pressing Ctrl+D (Unix/macOS) / Ctrl+Z then Enter (Windows), and then run the pip install pillow command in your operating system's command line interface (terminal/command prompt). Warnings
breaking Dropped support for Python 3.9 in version 12.0.0. ↓
fix Upgrade to Python 3.10 or later.
breaking Removed support for FreeType <= 2.9.0 in version 12.0.0. ↓
fix Upgrade FreeType to version 2.10.0 or later.
deprecated Deprecated getdata() in favor of get_flattened_data() in version 12.1.0. ↓
fix Use get_flattened_data() instead of getdata().
deprecated Deprecated Image._show in version 12.0.0. ↓
fix Use alternative methods for displaying images.
gotcha Using _getexif() may return None if the image lacks EXIF data. ↓
fix Check if _getexif() returns None before accessing its contents.
gotcha Image.open() raises FileNotFoundError if the specified image file does not exist at the given path. ↓
fix Ensure the image file exists at the specified path and has appropriate read permissions.
breaking Attempting to open a non-existent image file raises `FileNotFoundError`. ↓
fix Verify the image file path and ensure the file exists before calling `Image.open()`.
Install compatibility verified last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) - - 0.05s 37.3M
3.10 slim (glibc) - - 0.03s 38M
3.11 alpine (musl) - - 0.12s 39.7M
3.11 slim (glibc) - - 0.10s 41M
3.12 alpine (musl) - - 0.07s 31.4M
3.12 slim (glibc) - - 0.07s 32M
3.13 alpine (musl) - - 0.07s 31.1M
3.13 slim (glibc) - - 0.07s 32M
3.9 alpine (musl) - - 0.05s 34.6M
3.9 slim (glibc) - - 0.04s 36M
Imports
- Image wrong
import Imagecorrectfrom PIL import Image - ImageDraw wrong
import ImageDrawcorrectfrom PIL import ImageDraw - ImageFont wrong
import ImageFontcorrectfrom PIL import ImageFont
Quickstart stale last tested: 2026-04-23
from PIL import Image
# Open an image file
with Image.open('example.jpg') as img:
# Display image
img.show()
# Save image in a different format
img.save('example.png')