Some answers have nice animations, for example. I have been looking round meta to get guidance on how to post animations and not found any. Is there a post on how to do this?


Thanks to Szabolcs we now have a nice tutorial. The bit that fooled me for a while is the need to have the full definition of the gif i.e (from below).

Export["~/Desktop/animation.gif", frames, "GIF", 
 AnimationRepetitions -> Infinity, "AnimationDurations" -> 1/20]

I tried without the AnimationRepetitions-> Infinity and just got two shows.

Further, a minor point but again had me fooled, is to use the image inserter on the toolbar. This puts a complicated reference e.g.


as a placeholder for the video and an even more complicated reference e.g.

[1]: https://i.sstatic.net/UsRkK.gif

at the end of the post. Thanks for all your help. I guess we can't automate this onto the SE Uploader...

  • 1
    Possible duplicate of How to make animated screen captures? Commented Nov 8, 2018 at 22:44
  • Maybe the functions CurrentNotebookImage or CurrentScreenImage (new in version 11.3) could be usefull for that. I have tried a little bit but gave up because the cursor was invisible, and that was inacceptable for my animation.
    – andre314
    Commented Nov 8, 2018 at 23:01
  • The question you linked used ListAnimate. That means, a list of graphics was available which can easily be exported as gif animation. This is what you see in the post.
    – halirutan Mod
    Commented Nov 9, 2018 at 1:09
  • These animations are just GIF or APNG files (+ other formats?), which are posted like normal images.
    – Karsten7
    Commented Nov 9, 2018 at 6:11
  • 1
    Like halirutan said, what people do is that they generate a list of frames, and then pass that list to Export. It is documented here. You can upload this on Stack Exchange unless it exceeds the maximum file size, which currently is 2 MB. Related question: 27202
    – C. E.
    Commented Nov 9, 2018 at 8:42

1 Answer 1


I think it is useful to have a tutorial for those who are less familiar with this topic. So here it goes.

Most animations you see here are animated GIF files. Once you have created the GIF file, it can be posted the same way as any other image.

Mathematica can export animated GIFs. Here is one example:

vp = OptionValue[Graphics3D, ViewPoint]
(* {1.3, -2.4, 2.} *)

frames = Table[
   Plot3D[Sin[x] Cos[y], {x, -5, 5}, {y, -5, 5}, SphericalRegion -> True, 
    ViewPoint -> RotationTransform[theta, {0, 0, 1}][vp]],
   {theta, 0., 2 Pi - 2 Pi/60, Pi/60}

Before you export the frames, you can preview them with ListAnimate.

Export["~/Desktop/animation.gif", frames, "GIF", 
 AnimationRepetitions -> Infinity, "AnimationDurations" -> 1/20]

enter image description here

GIF files are often very large. StackExchange has a 2 MB limit on images. If that is not enough, Google for "GIF optimizer" and use one of the many online services to reduce the file size. For the above animation, I used https://ezgif.com/

A different method to create animated GIFs is to create a screen recording. I use LICEcap for this.

Here's an example:

enter image description here

  • Thanks for this. I have added a couple of elementary points I missed, when I tried, into my question.
    – Hugh
    Commented Nov 9, 2018 at 12:19
  • Following this answer I have tried LICEcap. It's very satisifying. Some good points : one sees when the operator is clicking the mouse, the files are very small, I didn't have to change or tune the default parameters. Here and here are example of use-cases.
    – andre314
    Commented Jan 16, 2019 at 19:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .