-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Allow saving PNGs through Pillow instead of the builtin _png module. #13207
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
Conversation
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See discussion in #13094 (review).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right. I even saw that at the time. (though, maybe a comment here though just to remind the unwary).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me once it passes the test...
0aecdc1
to
9c7f926
Compare
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Randomly surfing this change from a watched issue
Why initing metadata = {}
is just a line below it's inited to something else again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used on line 513.
PR Summary
(Because Pillow exposes more (most?) PNG options.)
Closes #5397.
PR Checklist