Showing Image in Juno image pane in real time

I am working on a toy raytracer program and I would like to be able to show partial renders while the image is being rendered, ie. showing the current state of the image every n iteration of the main loop. However, I am not able to show images in Juno in real time. I know that returning a matrix of RGB from a function will show it as an image but this is not what I want. show(img) doesn’t seem to work as it simply outputs it as text in the console. ImageShow.gif([img]) kind of works but the quality is awful. Other than that, I haven’t been able to find how to use ImageShow.

hello, i am having the same issue. The first tutorial on julia images keeps saying ‘images are just arrays’ but I can’t find a simple way to output one.

ddi you have any success. I just want some kind of function like

showimage( matrix{3xwidthxheight})

“images are just arrays” means any image is an array of a colorant type.

julia> img = rand(RGB, 5, 5) # Matrix{RGB{Float64}}

and if you’re in IDE that supports image display, you get a good-looking result. Here’s what I get in vscode

image

This is a bit different from what you’re used to in other image processing frameworks, where people typically uses raw numerical array.

To convert a 3x5x5 array to a colorant array:

colorview(RGB, rand(3, 5, 5))

You might want to explicitly call display(img) for every few iterations. Sometimes a sleep(0.01) before display(img) helps flush the display panel.

fantastic! this is exactly what I needed. thank you so much. I think it was this special ‘colorant’ type that i didn’t understand

1 Like

Hope you enjoy JuliaImages :laughing:

Because I don’t check discourse very often, please feel free to ping me if you want help. You can also open issues (or discussions) on GitHub or use the #image-processing channel on slack.