Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Add ImageMagick[File]Writer compression arg#15784
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
I personally don't like the idea of reproducing the imagemagick command line as kwargs. (Also, should this use-layers Optimize
or-layers OptimizePlus
? (https://www.imagemagick.org/script/command-line-options.php?#layers)). So I'm going to block this but am willing to back out if there's enough support for it.
I think better solutions would be to document this in the docstring of ImageMagickWriter/ImageMagickFileWriter, e.g. "For smaller animation sizes, consider setting extra_args to ["-layers", "OptimizePlus"]" -- or even to turn it on unconditionally.
@anntzer Can you further detail your concerns? Right now, the entire purpose of |
Thanks for the feedback. I agree with@anntzer, in that reproducing common args from a utility as args in python does seem like a code smell. I would be fully on board with making compression the de-facto behavior. I personally initially presumed that matplotlib's use of ImageMagick would do the obvious method of reducing file size by not making each frame of the .gif full-sized. Doing the above, I'd be tempted to allow the end-user to disable with a Regarding Btw, still curious if there's a faster method of iterating on checking the generated docstings. |
Basically, committing to one's memory that the compress kwarg to ImageMagickWriter improves the size of the movie is a totally non-generalizable knowledge. It doesn't help you if you want to use imagemagick directly (and the imagemagick docs will obviously not point to that kwarg either), and it doesn't help you either if you switch to another animation writer class. Also, if imagemagick decides later to introduce a better optimization flag (OptimizePlusPlus), do we need to keep "compress=True" mapped to Optimize for backcompat? Re: docs build: yeah, it's a bit of a pain. Builds after the first should be less awfully slow, though. |
@anntzer That makes sense. I guess we can't make it the default then though, because there'd be no way to override... |
anntzer commentedNov 30, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
You can put it as default in |
That seems reasonable to me. |
I'll check that out and update the PR sometime in the next week or so 👍 |
Any progress here? |
I've gotta dig into the rcparams stuff a bit before I can do the suggested changes. Maybe this weekend. |
I don't anticipate digging into this code again, unfortunately. Feel free to close. |
Superseded by#23371. Thanks for the suggestion! |
PR Summary
Follow-up to my previous PR#15739. Adding a simple
compress
arg toImageMagickWriter
andImageMagickFileWriter
classes.Questions
I'm suspecting that the docstring is not done right. Sphinx probably doesn't combine the
MovieWriter.__init__()
docstring and child class'__init__()
docstrings automagically. Never dealt with child classes and shared docstrings when I more heavily used sphinx years ago. Is the correct thing to do here to just duplicate the shared args? From what I've seen looking around, I suspect not?Also, I'm definitely curious to hear what the optimal approach to testing docstring changes/additions is?
make html
indocs/
is awfully slow. (d'oh, I see now there is a -O j4 option I can pass; will do that next time)Further tangents on docs:
python
doesn't point atpython3
by default? I modified the docs Makefile to usepython3
, as the format strings in (iirc)conf.py
didn't make 2.x happy. I could imagine other distros that are more fully on Python3 do link/bin/python
to/bin/python3
.PR Checklist