# Save animation makie

**URL:** <https://discourse.julialang.org/t/save-animation-makie/59879>\
**Category:** General Usage\
**Tags:** makie\
**Created:** [April 23, 2021, 2:17pm UTC](https://discourse.julialang.org/t/save-animation-makie/59879 "2021-04-23T14:17:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![boroboro77](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/boroboro77/32/20045_2.png) [@boroboro77](https://discourse.julialang.org/u/boroboro77)\
**Post date:** [April 23, 2021, 2:17pm UTC](https://discourse.julialang.org/t/save-animation-makie/59879/1 "2021-04-23T14:17:04Z")

</div>

I am trying to save an animation using Makie.jl. I have no clue how this should work using the record method.  
I manage to see the animated output in the popup, but I can nowhere find the output as an “.mp4” with the filename I have specified.  
I also tried without success to use the FileIO.save function.

Does someone have a working example how this is intended to work? I am lost…  
Thanks for your help

---

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [April 23, 2021, 3:54pm UTC](https://discourse.julialang.org/t/save-animation-makie/59879/2 "2021-04-23T15:54:55Z")

</div>

[https://makie.juliaplots.org/stable/animation.html](https://makie.juliaplots.org/stable/animation.html)

Also, are you using Makie, or `using GLMakie`, or `using CairoMakie`. You should not install Makie, but one of the backends. [Home](https://makie.juliaplots.org/stable/index.html)

---

<div class="post-metadata">

**Author:** ![boroboro77](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/boroboro77/32/20045_2.png) [@boroboro77](https://discourse.julialang.org/u/boroboro77)\
**Post date:** [April 23, 2021, 4:28pm UTC](https://discourse.julialang.org/t/save-animation-makie/59879/3 "2021-04-23T16:28:33Z")

</div>

Thanks. I know this link. But I don’t understand what to do. Nothing I tried worked. How do I get from this code:

```julia
import GLMakie
using Random, Colors

framerate = 24
rng = Random.default_rng()

function randomImage(rng)
     M = Matrix{RGB{Float32}}(undef, 1000, 1000)
     @. M = RGB(rand(rng), rand(rng), rand(rng))
     return M
end

img = randomImage(rng)
scene = GLMakie.Scene(resolution = reverse(size(img)))
makieimg = GLMakie.image!(scene, img, show_axis = false, scale_plot = true)
display(scene)
timestamps = 0:1/framerate:2

record(scene, "noise_animation.mp4", timestamps) do i
    img = randomImage(rng)
    makieimg[1]= img
end

```

to a .mp4 file?

---

<div class="post-metadata">

**Author:** ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Post date:** [April 23, 2021, 5:15pm UTC](https://discourse.julialang.org/t/save-animation-makie/59879/4 "2021-04-23T17:15:22Z")

</div>

Ok. I tested the following, and it works. Take a look.

```julia
using GLMakie
using Random, Colors
framerate = 24
rng = Random.default_rng()
function randomImage(rng)
     M = Matrix{RGB{Float32}}(undef, 500, 500)
     @. M = RGB(rand(rng), rand(rng), rand(rng))
     return M
end
img = randomImage(rng)
imgNode = Node(img)
fig = Figure(resolution = reverse(size(img)))
ax = Axis(fig)
image!(ax, imgNode, show_axis = false, scale_plot = true)
hidedecorations!(ax)
hidespines!(ax)
fig[1,1] = ax
timestamps = 0:1/framerate:5
record(fig, "noise_animation.mp4", timestamps) do i
    imgNode[] = randomImage(rng)
end

```

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [April 23, 2021, 6:13pm UTC](https://discourse.julialang.org/t/save-animation-makie/59879/5 "2021-04-23T18:13:49Z")

</div>

Perhaps you are not where you think you are?

are you doing this in a notebook or in the REPL?

could you do `julia> pwd()`? This will show the directory where you are working, and where the file is saved.

---

<div class="post-metadata">

**Author:** ![boroboro77](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/boroboro77/32/20045_2.png) [@boroboro77](https://discourse.julialang.org/u/boroboro77)\
**Post date:** [April 23, 2021, 11:28pm UTC](https://discourse.julialang.org/t/save-animation-makie/59879/6 "2021-04-23T23:28:02Z")

</div>

Oh thank you a lot. Such a stupid error. I’ve run the code completely elsewhere.
