Skip to content

Problem with documentation on .getextrema() #8999

@beruic

Description

@beruic

What did you do?

from PIL import Image

grey_rgb = Image.new("RGB", (256,256), (128, 128, 128))
grey_greyscale = grey_rgb.convert("L")
print(grey_greyscale.getextrema())

What did you expect to happen?

I expected the output to be in floats, like the documentation at https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.getextrema mentions

What actually happened?

I got a tuple of integers: (128, 128)

What are your OS, Python and Pillow versions?

  • OS: Ubuntu 24.04.2 LTS
  • Python: 3.12.3
  • Pillow: 11.2.1 (installed via pip in a virtualenv)
--------------------------------------------------------------------
Pillow 11.2.1
Python 3.12.3 (main, Feb  4 2025, 14:48:35) [GCC 13.3.0]
--------------------------------------------------------------------
Python executable is /home/jmk/.virtualenvs/layout-g4/bin/python3
Environment Python files loaded from /home/jmk/.virtualenvs/layout-g4
System Python files loaded from /usr
--------------------------------------------------------------------
Python Pillow modules loaded from /home/jmk/.virtualenvs/layout-g4/lib/python3.12/site-packages/PIL
Binary Pillow modules loaded from /home/jmk/.virtualenvs/layout-g4/lib/python3.12/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 11.2.1
*** TKINTER support not installed
--- FREETYPE2 support ok, loaded 2.13.3
--- LITTLECMS2 support ok, loaded 2.17
--- WEBP support ok, loaded 1.5.0
*** AVIF support not installed
--- JPEG support ok, compiled for libjpeg-turbo 3.1.0
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.3
--- ZLIB (PNG/ZIP) support ok, loaded 1.3, compiled for zlib-ng 2.2.4
--- LIBTIFF support ok, loaded 4.7.0
--- RAQM (Bidirectional Text) support ok, loaded 0.10.1, fribidi 1.0.13, harfbuzz 11.0.1
*** LIBIMAGEQUANT (Quantization method) support not installed
--- XCB (X protocol) support ok
--------------------------------------------------------------------
from PIL import Image

grey_rgb = Image.new("RGB", (256,256), (128, 128, 128))
grey_greyscale = grey_rgb.convert("L")
print(grey_greyscale.getextrema())

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions