Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PIL-opened image and imread-opened image render slightly differently in classic mode #14340

Open
Labels
keepItems to be ignored by the “Stale” Github Actiontopic: images
@anntzer

Description

@anntzer

Bug report

Bug summary

Per the title.

Code for reproduction

frompathlibimportPathimportmatplotlibasmplfrommatplotlib.testing.compareimportcompare_imagesfrommatplotlibimportpyplotasplt,stylefromPILimportImagempl.use("agg")mpl.style.use("classic")path=str(Path(mpl.__file__).parent/"tests/baseline_images/pngsuite/basn3p04.png")fig=plt.figure()fig.subplots().imshow(plt.imread(path))fig.savefig("1.png")fig=plt.figure()fig.subplots().imshow(Image.open(path))fig.savefig("2.png")print(compare_images("1.png","2.png",tol=0))

Actual outcome

Error: Image files did not match.  RMS Value: 0.010865337342004415  Expected:      1.png  Actual:        2.png  Difference:    2-failed-diff.png  Tolerance:     0

Expected outcome

No diff.

Ithink this may possibly(???) be due to rounding errors when imread converts from 0-255 (uint8) to 0-1 (float) and then imshow converts back to 0-255 (uint8)?

Note that this does not occur when using the mpl20 default style.

Matplotlib version

  • Operating system: linux
  • Matplotlib version: master
  • Matplotlib backend (print(matplotlib.get_backend())): agg
  • Python version: 3.7
  • Jupyter version (if applicable):
  • Other libraries:

Metadata

Metadata

Assignees

No one assigned

    Labels

    keepItems to be ignored by the “Stale” Github Actiontopic: images

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp