X Tutup
Skip to content

imsave-generated PNG files missing edges for certain resolutions #6855

@aWinglessMonkey

Description

@aWinglessMonkey

This is a bit of an odd problem, but has been reproducible for me in both Matplotlib 1.5.2 on Python 3.5.2 from Macports on Mac OS X 10.9.6 and Matplotlib 1.5.1 on Python 3.5.1 from Anaconda on Windows 10, both running on 64-bit 4-core Intel i7 processors (of significantly differing ages).

Any array with a dimension of 3421*2^n, for a non-negative integer n, will be missing one line along that dimension when saved as a PNG file through imsave. For example:

>>> n = np.zeros((3241,3241))
>>> plt.imsave('test.png', n)
>>> plt.imread('test.png').shape
(3240, 3240, 4)

Inspection of the file through the OS will also show the shortened resolution, and saving a more detailed image will show the missing lines are taken from the top and the right. Saving an RGB or RGBA array has the same result.

Considering the nature of the pattern, this would seem to be some sort of floating-point rounding error, though I have not been able to find a location it might occur. I also cannot currently confirm if it happens for more recent versions, such as is currently in this repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup