# Including generated gif files in the documentation

**URL:** <https://discourse.julialang.org/t/including-generated-gif-files-in-the-documentation/17363>\
**Category:** General Usage\
**Tags:** documenter\
**Created:** [November 9, 2018, 8:38pm UTC](https://discourse.julialang.org/t/including-generated-gif-files-in-the-documentation/17363 "2018-11-09T20:38:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lbenet](https://avatars.discourse-cdn.com/v4/letter/l/35a633/32.png) [@lbenet](https://discourse.julialang.org/u/lbenet)\
**Post date:** [November 9, 2018, 8:38pm UTC](https://discourse.julialang.org/t/including-generated-gif-files-in-the-documentation/17363/1 "2018-11-09T20:38:36Z")

</div>

Hi,

We are having problems to include in the documentation of [TaylorIntegration.j](https://github.com/PerezHz/TaylorIntegration.jl) some .gif files that are generated by the documentation (using `Plots.jl`); see [https://perezhz.github.io/TaylorIntegration.jl/latest/root\_finding.html](https://perezhz.github.io/TaylorIntegration.jl/latest/root_finding.html), which does not display two gif files.

We first tried to display them directly, as we would do for (generated) figure. We also tried copying the generated gif file to the `build` directory. None of these methods work, though both solutions are properly displayed locally.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [November 10, 2018, 12:00am UTC](https://discourse.julialang.org/t/including-generated-gif-files-in-the-documentation/17363/2 "2018-11-10T00:00:11Z")

</div>

I’ve had no problems, treating animated GIF files exactly the same as PNGs and JPGs. I can create them beforehand, or have them created as part of the Documenter run: in the MarkDown source, I can save newly-created files into the `docs/src/assets/` hierarchy:

````julia
```@example
   ...
   pathname="assets/figures/testanimation.gif")
   ...

`` ` 

![gif example](assets/figures/testanimation.gif)

````

I remember getting the paths right took a little bit of trial and error…

---

<div class="post-metadata">

**Author:** ![lbenet](https://avatars.discourse-cdn.com/v4/letter/l/35a633/32.png) [@lbenet](https://discourse.julialang.org/u/lbenet)\
**Post date:** [November 10, 2018, 1:30am UTC](https://discourse.julialang.org/t/including-generated-gif-files-in-the-documentation/17363/3 "2018-11-10T01:30:47Z")

</div>

Thanks a lot for the tip! I will try that!

---

<div class="post-metadata">

**Author:** ![lbenet](https://avatars.discourse-cdn.com/v4/letter/l/35a633/32.png) [@lbenet](https://discourse.julialang.org/u/lbenet)\
**Post date:** [November 12, 2018, 2:55am UTC](https://discourse.julialang.org/t/including-generated-gif-files-in-the-documentation/17363/4 "2018-11-12T02:55:55Z")

</div>

Sorry for insisting, can you provide more details or a link? I haven’t been able to work it out.

For completeness, this is the `@example` block we have

```julia
@example
   anim1 = @animate for i=1:20
       ...
   end
   gif(anim1, "anim1.gif", fps = 2)

```

I’ve tried with no success to include `pathname` inside the `gif()` clause when saving the animation, or saving it in the `build/assets` directory, which throws an error.

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [November 12, 2018, 9:13am UTC](https://discourse.julialang.org/t/including-generated-gif-files-in-the-documentation/17363/5 "2018-11-12T09:13:36Z")

</div>

Hmm… I don’t use Plots, but I just installed it and it seems to work out of the box, the way you’d expect:

 ![plots](https://global.discourse-cdn.com/julialang/original/3X/2/1/217fae4ba89685cdb9362a59d6b5d0b54335c39e.gif)

Note, you can’t save into the `build/` folder, because that’s deleted each time you start the Documenter run. I assume that it looks in the `docs/src/` folder.

---

<div class="post-metadata">

**Author:** ![lbenet](https://avatars.discourse-cdn.com/v4/letter/l/35a633/32.png) [@lbenet](https://discourse.julialang.org/u/lbenet)\
**Post date:** [November 12, 2018, 5:31pm UTC](https://discourse.julialang.org/t/including-generated-gif-files-in-the-documentation/17363/6 "2018-11-12T17:31:14Z")

</div>

Thanks for looking into this.

I agree that the gif is created properly. The generation of the docs works fine on my local machine; the problem appears when the documentation is generated by travis.

I noticed that the gif files are (locally) saved in the `build/` directory, but they do not make it into the `gh-pages` branch. Maybe the simplest solution is to save the gifs (statically) so they are in the repo, and link the displayed animation to those files.

Thanks for the help!
