Skip to content

PNG opens as I rather than I;16 #3796

@kevinptt0323

Description

@kevinptt0323

What did you do?

Open a 16-bit grayscale png and access its mode flag.

What did you expect to happen?

im.mode == 'I;16'

What actually happened?

im.mode == 'I'

What are your OS, Python and Pillow versions?

  • OS: Ubuntu 18.04.2 LTS (Linux 4.15.0-47)
  • Python: 3.6.7
  • Pillow: 6.0.0
import numpy as np
from PIL import Image

ar = np.ones((32, 32), dtype=np.uint16)
im = Image.fromarray(ar)
im.save('foo.png')

im = Image.open('foo.png')
assert im.mode == 'I;16'
> file foo.png 
foo.png: PNG image data, 32 x 32, 16-bit grayscale, non-interlaced

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugAny unexpected behavior, until confirmed feature.

    Type

    No type

    Projects

    Status

    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions