Skip to content

Formats and save options

Image.open() accepts paths and binary streams. image.save() infers the format from a path extension or takes an explicit format for streams. Animation and multipage editing are unsupported.

Format Read Write Save options and limits
PNG Yes Yes compress_level=0..9 (default 6); indexed and high-bit-depth output.
JPEG Yes Yes quality=1..100 (default 75); 8-bit L or RGB, not RGBA.
JPEG XL Yes Yes quality=1..100 (default 90), lossless=True|False, effort=1..10 (default 7); high-bit-depth support.
TIFF Yes Yes First image only; uncompressed output, no save options.
WebP Yes Yes First frame only; quality=1..100 (default 90), lossless=True|False (default False). Grayscale is stored as RGB.
AVIF Yes Yes Primary image only; 8-bit lossy output. quality=1..100 (default 90), effort=1..10 (default 7). Decodes as RGBA; grayscale is stored as RGB.
HEIC / HEIF Yes Yes Primary image only; HEVC. quality=1..100 (default 90), lossless=True|False (default False).
BMP Yes Yes 8-bit, uncompressed output.
GIF Yes Yes First frame only; single-frame output with up to 256 colors and binary transparency.
ICO Yes Yes Largest icon on read; one PNG icon on write, 1–256 pixels per dimension.
PDF No Yes Single-page 8-bit output; no save options.

HEIC and HEIF both report image.format == "HEIF". Opening HEIF applies container rotations and crops. Its grayscale HEVC output opens as RGB in Blanket. The x265 encoder uses its medium preset; lossless=True selects lossless HEVC, but RGB/YUV conversion can still change samples.

PDF uses lossless, uncompressed image streams for grayscale, RGB, and RGBA pixels. Each pixel occupies one point at 72 DPI. It does not support reading, multiple pages, metadata, or high-bit-depth input.

For per-format precision, see high bit depth. Saving writes pixels only; source EXIF, XMP, and ICC metadata are not carried through. For smaller output, see Compressor.