Save animation makie

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

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 · Makie Plotting Ecosystem

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

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?

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

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

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.

1 Like

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