Thanks to visit codestin.com
Credit goes to github.com

Skip to content

imsave outputs JPEG with wrong dimension #13253

Closed
@tboch

Description

@tboch

Bug report

Bug summary

When saving a 2d array in JPEG format, imsave generates an image of wrong dimension. This only happens for some specific array sizes, and only in JPEG (PNG outputs are fine for instance)

Code for reproduction

import matplotlib.image as mimg
import numpy as np
import PIL

x = np.zeros((1856, 1728))
mimg.imsave('foo.jpg', x, format='jpg')
jpg_im = PIL.Image.open('foo.jpg')
jpg_im.size

Actual outcome

(1728, 1855)

Expected outcome

(1728, 1856)

Matplotlib version

  • Operating system: Debian 9
  • Matplotlib version: 3.0.2
  • Matplotlib backend (print(matplotlib.get_backend())): TkAgg
  • Python version: 3.5.3
  • Other libraries: PIL 5.0.0

matplotlib installed from pip

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