Skip to content

Pillow destroys image by incorrectly binarizing grayscale image during show() #6765

Description

@apacha

What did you do?

I've probably discovered a severe bug in PIL. I'm trying to open an image but when opening and showing it with PIL, the image is incorrectly binarized and visually completely destroyed.

0026

What did you expect to happen?

That the image opens without being destroyed.

What actually happened?

The image gets destroyed:
0026_destroyed

What are your OS, Python and Pillow versions?

  • OS: MacOS
  • Python: 3.9
  • Pillow: 9.3.0
from PIL import Image
Image.open("0026.png").show()

when reading the very same image with opencv, it works just fine:

import cv2
img_cv2 = cv2.imread("0026.png")
Image.fromarray(img_cv2).show()

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