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

Make 'convert' the standard way to produce animated gifs (again) #11650

Closed
jhpalmieri opened this issue Aug 4, 2011 · 10 comments
Closed

Make 'convert' the standard way to produce animated gifs (again) #11650

jhpalmieri opened this issue Aug 4, 2011 · 10 comments

Comments

@jhpalmieri
Copy link
Member

In ticket #11170, code was added so that if ffmpeg is present, it gets used by default to produce animated gifs. These can be much larger than the ones produced by 'convert', plus there may be other problems with ffmpeg. The attached patch makes 'convert' the default again.

Depends on #11170

Component: graphics

Keywords: animate convert ffmpeg

Author: John Palmieri

Reviewer: Dan Drake

Merged: sage-4.8.alpha3

Issue created by migration from https://trac.sagemath.org/ticket/11650

@kini
Copy link
Contributor

kini commented Aug 5, 2011

Dependencies: 11170

@kini
Copy link
Contributor

kini commented Aug 5, 2011

comment:2

Just by the by, what do you think about bundling GraphicsMagick (a fork of ImageMagick by a group of its original developers) with Sage? Apparently it is faster than ImageMagick (I'm told, by a user, that it is faster by a factor of three for these animation type things). It's also X11-licensed, so if I understand correctly it is possible to bundle it, unlike ImageMagick. The source occupies ~38 MB.

@kini
Copy link
Contributor

kini commented Aug 5, 2011

Changed dependencies from 11170 to #11170

@jhpalmieri
Copy link
Member Author

comment:4

I've never used GraphicsMagick, but I'll take a look some time. It would be nice to include it, if it's that small. Does it need libjpeg or anything else like that?

@jhpalmieri
Copy link
Member Author

comment:6

Here's a new patch; the only changes are the following:

diff --git a/sage/plot/animate.py b/sage/plot/animate.py
--- a/sage/plot/animate.py
+++ b/sage/plot/animate.py
@@ -587,7 +587,7 @@ please install it and try again."""
                 print "Error running ffmpeg."
                 raise
 
-    def save(self, filename=None, show_path=False):
+    def save(self, filename=None, show_path=False, use_ffmpeg=False):
         """
         Save this animation.
 
@@ -598,6 +598,10 @@ please install it and try again."""
         -  ``show_path`` - boolean (default: False); if True,
            print the path to the saved file
 
+        - ``use_ffmpeg`` - boolean (default: False); if True, use
+          'ffmpeg' by default instead of 'convert' when creating GIF
+          files.
+
         If filename is None, then in notebook mode, display the
         animation; otherwise, save the animation to a GIF file.  If
         filename ends in '.sobj', save to an sobj file.  Otherwise,
@@ -632,7 +636,8 @@ please install it and try again."""
                 suffix = '.gif'
 
         if filename is None or suffix == '.gif':
-            self.gif(savefile=filename, show_path=show_path)
+            self.gif(savefile=filename, show_path=show_path,
+                     use_ffmpeg=use_ffmpeg)
             return
         elif suffix == '.sobj':
             SageObject.save(self, filename)

This allows you to do a.save('foobar.gif', use_ffmpeg=True).

I'm not seeing the issue with delay being a string. Can you please try again?

@jhpalmieri
Copy link
Member Author

Attachment: trac_11650-animate.patch.gz

@jdemeyer
Copy link

Merged: sage-4.8.alpha3

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

No branches or pull requests

6 participants
@jasongrout @kini @williamstein @jhpalmieri @jdemeyer and others