Skip to content

matplotlib.pyplot.imread silently fails on uint16 images. #3616

@jni

Description

@jni

It assumes the image is uint8 and incorrectly wraps the input at 255:

In [1]: from skimage import io

In [15]: io.imsave('io3.png', np.array([[0, 1], [0, 4196]], dtype=np.uint16),
            plugin='pil')

In [19]: from matplotlib.pyplot import imread

In [20]: imread('io3.png')
Out[20]: 
array([[ 0.        ,  0.00392157],
       [ 0.        ,  0.39215687]], dtype=float32)

In [21]: import matplotlib as mpl

In [22]: mpl.__version__
Out[22]: '1.3.1'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy