Open
Description
What did you do?
Trying to obtain the histogram of a image of mode "LA".
What did you expect to happen?
Get the correct histogram.
What actually happened?
Got the wrong histogram. It seems that the histogram of the "L" channel was duplicated into the histogram of the "A" channel.
What are your OS, Python and Pillow versions?
- OS: MacOS
- Python: 3.13.5
- Pillow: 11.2.1
--------------------------------------------------------------------
Pillow 11.2.1
Python 3.13.5 (v3.13.5:6cb20a219a8, Jun 11 2025, 12:23:45) [Clang 16.0.0 (clang-1600.0.26.6)]
--------------------------------------------------------------------
Python executable is /usr/local/bin/python3
System Python files loaded from /Library/Frameworks/Python.framework/Versions/3.13
--------------------------------------------------------------------
Python Pillow modules loaded from /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/PIL
Binary Pillow modules loaded from /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 11.2.1
--- TKINTER support ok, loaded 8.6
--- 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.1
--- LIBTIFF support ok, loaded 4.7.0
*** RAQM (Bidirectional Text) support not installed
*** LIBIMAGEQUANT (Quantization method) support not installed
--- XCB (X protocol) support ok
--------------------------------------------------------------------
from PIL import Image
img = Image.new("LA",(100,100),(10,255))
hist = img.histogram()
print()
print("Wrong histogram")
print(hist)
# Workaround
hist[256:512] = img.getchannel("A").histogram()
print()
print("Correct histogram")
print(hist)
Metadata
Metadata
Assignees
Labels
No labels