Read and write/save 3-D image

Hello! I have problem with image manipulation.

I want to save a 3D image array in png format.
Also wanted to know how to plot an image with some function of ImageView or Image package.

Image encoding is RGB.

If anyone can help, thank you in advance.

What did you try so far? All this should Just Work. PNG is a 2d format but you’ll get a sequence of images when you save it.

what I am trying to do is this:
save(“rgb.png”, img)
but, that gives error.

Also, i tried to imgshow to show the image, but gives the same error.

julia> using Colors, FileIO, ImageView

julia> img = rand(RGB, 200, 200, 5);

julia> imshow(img)      # just works
Dict{String,Any} with 4 entries:
  "gui"         => Dict{String,Any}("window"=>GtkWindowLeaf(name="", parent, wi…
  "roi"         => Dict{String,Any}("redraw"=>68: "map(clim-mapped image, input…
  "annotations" => 4: "input-3" = Dict{UInt64,Any}() Dict{UInt64,Any} 
  "clim"        => 3: "CLim" = CLim{RGB{Float64}}(RGB{Float64}(0.0,0.0,0.0), RG…

julia> save("/tmp/img.png", img)    # results in 5 files, one per frame
1 Like

I @tim.holy have any change in save() function to png format? It’s giving error = “save not defined”!!! I just do “using FileIO” , but the error continues.

i just tried Tim’s code and it works. However there are a lot of external package dependencies. However, “the error continues” is not particularly helpful, please read the following and provide some more detail. My guess is that you have a package configuration problem of some sort, or even a missing package.