Allow saving PNGs through Pillow instead of the builtin _png module.#13207
Merged
Conversation
jklymak
reviewed
Jan 17, 2019
| for k, v in metadata.items(): | ||
| pnginfo.add_text(k, v) | ||
| pil_kwargs["pnginfo"] = pnginfo | ||
| pil_kwargs.setdefault("dpi", (self.figure.dpi, self.figure.dpi)) |
Member
There was a problem hiding this comment.
This is a little confusing - if the user passes dpi=200 to savefig it will be ignored in lieu of self.figure.dpi? Is there no way to pass the dpi from savefig as the default instead (of course falling back to self.figure.dpi?
Member
There was a problem hiding this comment.
Ah right. I even saw that at the time. (though, maybe a comment here though just to remind the unwary).
Member
There was a problem hiding this comment.
This looks fine to me once it passes the test...
0aecdc1 to
9c7f926
Compare
jklymak
approved these changes
Jan 17, 2019
phobson
approved these changes
Jan 17, 2019
keul
reviewed
Jan 18, 2019
| user_metadata = kwargs.pop("metadata", None) | ||
| if user_metadata is not None: | ||
| metadata.update(user_metadata) | ||
| if metadata is None: |
There was a problem hiding this comment.
Randomly surfing this change from a watched issue
Why initing metadata = {} is just a line below it's inited to something else again?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
(Because Pillow exposes more (most?) PNG options.)
Closes #5397.
PR Checklist