I have an input signal parameterized by time, which consists of a time dependent noise mask added on top of a base image defined as:
I(t) = X + noise(t)
I now want to create a gif animation using Plots to see what the signal looks like. The library example tells me to do something like this:
plt = plot(1)
@gif for i=1:500
frame = I(i)
push!(plt, frame)
end every 10
However, frame here is an image, not several variables. I was experimenting with imshow but I get an since this does not return a plot object. What is the right way of doing this?
Your best bet is probably Makie.jl, which can do this sort of thing before breakfast (and not just for cat images…)
Deep in the wilder fringes of the Julia ecosystem you’ll find Luxor.jl, which has the words “PNG”, “image”, “noise”, “GIF”, and “animation” in the documentation as this image confirms…
… I abandoned this attempt at a pictorial Viking send-off for Attobot a while ago but it’s now found a home. However, I feel that Luxor is designed more for recreational use, and doesn’t provide such obviously essential plotting features such as axes, tick marks, and legends.
(Issues, pull requests, and stars are all welcome!)
Animated PNGs look like they’d be a better solution than animated GIFs, but I don’t think there’s enough support as regards utilities and editing tools at present. For example, how do you get them to loop?
↑ This pet cthulhu is an animated PNG, but I’ve only ever seen it move once. If it were a serious scientific animation, I’d be disappointed in the AnimatedPNG format.
All my APNG loop forever.
I for one usually just wrap my scripts around APNG Assembler.
I write to HD the PNG files and run a command line to wrap them all into APNG.
As you can see you can set the number of loops (Or infinite) etc…
Ah, that’s cool, thanks - I couldn’t find out how to edit an existing animated PNG, but it’s easy enough to post-process the original still frames again.
It’s clever that you can use the same suffix .PNG for both still and animated images, but it would be good if file managers could show previews (the Finder on macOS doesn’t, but perhaps its different on other platforms…?).
This doesn’t work because plot treats the input as an y-axis values with the index in the array being the corresponding x-axis if it is not provided. Reshaping only means that now I have 32 sequences of y-values for 32 x-values.
This seems like the simplest way, yes. I can just concatenate the frames into one array. Does the time dimension need to be the last one?
Thanks, this indeed looks useful, though probably an overkill for what I want to do right now which is just look at what I’m doing. Still, probably better for flashier presentations.
FYI, the various plotting packages (e.g., Makie, Plots, etc) and ImageView all allow you to visualize time-varying images from within Julia. For time-varying images, ImageView will give you a player-widget that you can use to go back and forth in time:
Thank you again.
The created animated gif is perfect but I wonder If I could display it directly inside vscode (not via ImageView or clicking on the gif file) ?