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

Pillow animation writer. #10240

Merged
merged 1 commit into from
Jan 22, 2018
Merged

Pillow animation writer. #10240

merged 1 commit into from
Jan 22, 2018

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jan 13, 2018

PR Summary

Closes #10229.

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 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

@dstansby
Copy link
Member

Can we test this? I'm guessing there's not image comparison test, but a smoke test should be possible right?

@writers.register('pillow')
class PillowWriter(MovieWriter):
@classmethod
def isAvailable(cls):
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason this is cls and not self? (just asking out of curiosity!)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because you need to check whether the class is available before instantiating one (at least that's how the animation framework is setup).

@dstansby dstansby added this to the v3.0 milestone Jan 16, 2018
@anntzer
Copy link
Contributor Author

anntzer commented Jan 16, 2018

It is smoketested (as much as every other writer...)

Copy link
Contributor

@dopplershift dopplershift left a comment

Choose a reason for hiding this comment

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

I know I've thought about this in the past, so thanks for adding! With this, it's possible to make an animated gif without needing to resort to Imagemagick.

Writing animations with Pillow
``````````````````````````````
It is now possible to use Pillow as an animation writer. Supported output
formats are currently gif (Pillow>=3.4) and webp (Pillow>=5.0).
Copy link
Member

Choose a reason for hiding this comment

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

Can you include a small example here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

Works for me! Thanks

@jklymak jklymak merged commit 40d336a into matplotlib:master Jan 22, 2018
@anntzer anntzer deleted the pillow-anim branch January 22, 2018 18:25
@QuLogic QuLogic modified the milestones: v3.0, v2.2 Jan 25, 2018
@stonebig
Copy link
Contributor

can't wait for v 2.2

@QuLogic QuLogic modified the milestones: needs sorting, v2.2.0 Feb 12, 2018
@@ -117,6 +117,7 @@ def isAvailable(self):
('avconv_file', 'movie.mp4'),
('imagemagick', 'movie.gif'),
('imagemagick_file', 'movie.gif'),
('pillow', 'movie.gif'),
Copy link
Member

Choose a reason for hiding this comment

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

this seems to be causing issues on MacOS for some reason. Pillow tests in test_images have a decorator @needs_pillow which lets most of the tests pass. This test doesn't, so the tests are now failing.... Of course the underlying issue is that pillow is not being installed properly somehow on macOS...

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.

ENH: Add imageio as an option for saving animated gifs
6 participants