Skip to content

Fix Pillow compatibility in example #23881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 15, 2022

Conversation

oscargus
Copy link
Member

PR Summary

Should fix #23855 (comment)

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

@oscargus oscargus added this to the v3.6.0 milestone Sep 13, 2022
@oscargus oscargus marked this pull request as ready for review September 13, 2022 08:33
@anntzer
Copy link
Contributor

anntzer commented Sep 13, 2022

Instead of resampling down the stinkbug image down to 64x64 via pillow code (which is a bit distracting for the tutorial, especially if you start having version gating like here), perhaps simpler would be to just crop down to its central region? e.g. img[175:225, 225:275] seems reasonable. (Obviously the surrounding text needs adjusting too.)

@oscargus oscargus mentioned this pull request Sep 13, 2022
2 tasks
@oscargus
Copy link
Member Author

To be fully honest, I didn't read another line of the code except for the problematic one...

Doing that, do we actually need to specify the resampling scheme? I mean, it is really a Pillow-function that we are using, so maybe it is not that important? (Default is bicubic.)

(Btw, we also provide an, untested, thumbnail function, although that reads the file, possibly pops it up, and then saves it, as well as returning a Figure.)

@anntzer
Copy link
Contributor

anntzer commented Sep 13, 2022

I didn't really pay attention to the context either.

@oscargus oscargus force-pushed the pillowversionhandling branch from 2312f5a to 45c569c Compare September 13, 2022 08:50
@oscargus
Copy link
Member Author

I changed it to not specify resampling scheme (as that sort of makes sense as well and my previous approach was wrong).

@oscargus
Copy link
Member Author

oscargus commented Sep 13, 2022

It seems like the pikepdf install is suddenly failing...

6.0.0 was released yesterday with a 6.0.0.post1 release two hours ago. Maybe it is just to wait for wheels to be published?

@oscargus
Copy link
Member Author

oscargus commented Sep 13, 2022

Windows and OSX support is currently blocked: pikepdf/pikepdf#390

Pin version (except for Linux)?

@tacaswell
Copy link
Member

Pin version (except for Linux)?

Yes

@oscargus oscargus mentioned this pull request Sep 15, 2022
6 tasks
@anntzer anntzer closed this Sep 15, 2022
@anntzer anntzer reopened this Sep 15, 2022
@anntzer anntzer merged commit 7007c5c into matplotlib:main Sep 15, 2022
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Sep 15, 2022
tacaswell added a commit that referenced this pull request Sep 15, 2022
…881-on-v3.6.x

Backport PR #23881 on branch v3.6.x (Fix Pillow compatibility in example)
@oscargus oscargus deleted the pillowversionhandling branch September 16, 2022 12:00
melissawm pushed a commit to melissawm/matplotlib that referenced this pull request Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants