# @gif without saving all images

**URL:** <https://discourse.julialang.org/t/gif-without-saving-all-images/85160>\
**Category:** Visualization\
**Created:** [August 2, 2022, 12:19pm UTC](https://discourse.julialang.org/t/gif-without-saving-all-images/85160 "2022-08-02T12:19:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![qwerty](https://avatars.discourse-cdn.com/v4/letter/q/4491bb/32.png) [@qwerty](https://discourse.julialang.org/u/qwerty)\
**Post date:** [August 2, 2022, 12:19pm UTC](https://discourse.julialang.org/t/gif-without-saving-all-images/85160/1 "2022-08-02T12:19:49Z")

</div>

Is it possible to generate an animation with @gif without saving all images to disk?

---

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [August 5, 2022, 12:35pm UTC](https://discourse.julialang.org/t/gif-without-saving-all-images/85160/2 "2022-08-05T12:35:44Z")

</div>

Yes it is possible, what package that you use to generate the gif?

---

<div class="post-metadata">

**Author:** ![qwerty](https://avatars.discourse-cdn.com/v4/letter/q/4491bb/32.png) [@qwerty](https://discourse.julialang.org/u/qwerty)\
**Post date:** [August 5, 2022, 3:20pm UTC](https://discourse.julialang.org/t/gif-without-saving-all-images/85160/3 "2022-08-05T15:20:15Z")

</div>

Plots, with GR()

---

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [August 5, 2022, 3:39pm UTC](https://discourse.julialang.org/t/gif-without-saving-all-images/85160/4 "2022-08-05T15:39:40Z")

</div>

I use an example of animation from this website:  
[https://docs.juliaplots.org/latest/animations/](https://docs.juliaplots.org/latest/animations/)

I just add gr() at the second line

```julia
using Plots
gr()

@userplot CirclePlot
@recipe function f(cp::CirclePlot)
    x, y, i = cp.args
    n = length(x)
    inds = circshift(1:n, 1 - i)
    linewidth --> range(0, 10, length = n)
    seriesalpha --> range(0, 1, length = n)
    aspect_ratio --> 1
    label --> false
    x[inds], y[inds]
end

n = 150
t = range(0, 2π, length = n)
x = sin.(t)
y = cos.(t)

anim = @animate for i ∈ 1:n
    circleplot(x, y, i)
end
gif(anim, "anim_fps15.gif", fps = 15)

```

Save the code as `plot.jl` in an empty directory or any directory you want. I save it at `/home/browni/LasthrimProjection/`

Then I open terminal cd to that directory and type:

```julia
julia --project="."

julia> ]

pkg> add Plots

julia> include("plot.jl")

```

(in case you haven’t know create a new environment is better to manage packages in certain project)

There will be no images saved. You can include your animation file like my method above.

 ![Capture d’écran_2022-08-05_22-34-41](https://global.discourse-cdn.com/julialang/original/3X/3/f/3fe233c124838106dbeb0e93d31c40e0401dabae.png)

If you want to use IJulia / Jupyter Notebook it is more handy you can see the animation directly at the browser.

 ![Capture d’écran_2022-08-05_22-34-58](https://global.discourse-cdn.com/julialang/original/3X/7/9/79952ead402d9a077941b88c7c0ea121f666a17c.png)

Hope this will help you.

---

<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:** [August 5, 2022, 3:57pm UTC](https://discourse.julialang.org/t/gif-without-saving-all-images/85160/5 "2022-08-05T15:57:47Z")

</div>

If you use the `verbose=true` option - `gif(anim, "anim_fps15.gif", fps = 15, verbose=true)` - you’ll see where on disk the images are saved.

---

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [August 6, 2022, 10:22am UTC](https://discourse.julialang.org/t/gif-without-saving-all-images/85160/6 "2022-08-06T10:22:47Z")

</div>

Thanks @cormullion for the info.

If there is an option inside `gif()` function to not saving images, it would help @qwerty a lot
