I’m playing around with cellular automata and related systems, and I’m looking for a fast way to display them as they run.
Currently I’m using ImageView.imshow, which works, but it’s very, very slow - I can’t even resize the window to a convenient size without the frame rate dropping, so I have to view them in a tiny little corner of my screen.
So I’m looking for something faster. Is there another package that can display an array of RGB values as an image on the screen and then dynamically update that at a decent speed? I don’t need any fancy features beyond that, and speed is the only thing I really care about. (In particular, I don’t need to display the images on an axis with tick marks - just a window with the image in it would be fine.)
For example, can Makie.jl accomplish this task, and if so, is there some example code somewhere? I found this for displaying an image, but nothing about dynamically updating it.
In an ideal world I’d like to display each pixel of my image as an n x n block of screen pixels, so that they’ll all be perfectly square. If there’s something out there that can do that it would be amazing.
Yeah, Makie’s TTFP is infamously bad, but the flexibility, customizability, and time to nth plot are excellent. Hopefully the native code serialization efforts in Julia v1.9 will bring significant improvements in the TTFP department, but in the meantime, I’d recommend trying the VSCode Julia extension’s auto-sysimage tooling to reduce latency.
Assuming you aren’t doing much image processing beyond displaying your images, you can also reduce loading overhead by only pulling in ImageCore.jl instead of all of Images.jl.
I wasn’t really complaining about the framerate, by the way, sorry if it came across that way. 150-200 is respectable, and much better than ImageView was offering me. (It is a bit annoying if it’s only displaying some of the frames as I suspect, but that’s a different issue.)
I think you’re seeing frames dropped because the Julia-side display pipeline isn’t yielding to the OpenGL side often enough when running flat-out. That’s the value of sleep(1/30) (or 1/60 or some other reasonable frame rate) - it leaves time for graphics display. Ideally you’d be plotting asynchronously from the data-generating process, but I’m not sure how much time you want to invest in software engineering versus just playing around with cellular automata.