Skip to content
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

Allow passing arguments to PIL.Image.save(). #13094

Merged
merged 1 commit into from
Jan 17, 2019

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jan 3, 2019

PR Summary

Closes #8530; more general than #8531 (this way we don't need to implement each and every kwarg separately).
Unfortunately, does not help with #5397 as png output does not go though pillow.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@tacaswell tacaswell added this to the v3.1 milestone Jan 4, 2019
@tacaswell
Copy link
Member

👍 in principle, but needs a test.

@anntzer
Copy link
Contributor Author

anntzer commented Jan 4, 2019

Test added. (Explicitly not testing compression for tiff as that requires pillow+libtiff and I'd rather write something independent of whether libtiff is installed.)
I realized we could also fix #5397 by having png-saving also go through pillow when pil_kwargs is not None, but that'll be a separate PR after this one.

lib/matplotlib/figure.py Outdated Show resolved Hide resolved
lib/matplotlib/backends/backend_agg.py Outdated Show resolved Hide resolved
Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conditional on CI passing.

@efiring
Copy link
Member

efiring commented Jan 17, 2019

Looks good, but I see a test using pil_kwargs only for TIFF, not for Jpeg. Can the latter be added easily?

@anntzer
Copy link
Contributor Author

anntzer commented Jan 17, 2019

@efiring That's because Pillow can be built with or without libjpeg support, and I don't want to bother checking what build variant we have (I'm not even sure what to check or what exception to catch -- if you know, please let me know); on the other hand, Pillow always does have tiff support (as that's pure python).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: TIFF LZW compression support in savefig()
5 participants