Trouble displaying an image using ImageView.imshow()

I am using Julia with Atom on a MacBook Pro
When I try to display an image like in the following few lines at the REPL

using Images, ImageView, TestImages
img = testimage(“mandrill”)
ImageView.imshow(img)

a window appears but it is entirely white.
Is there something to do with the configuration of backends for instance to obtain a correct display?

1 Like

It works here (without the third line).

I noticed an Enable Plot Pane check box - is it possible that’s off for some reason>

1 Like

Great! Indeed it works …
Nonetheless I would also like to have the image displayed in an external window outside Atom just the same way I am using external windows to use PyPlot.

Any idea about a way to have the display outside Atom?

But thanks anyway … It’s already better!

Le jeu. 18 juil. 2019 à 16:45, Cormullion via JuliaLang julialang@discoursemail.com a écrit :

If you are working with images ImageView and Gtk.ShortNames might be interesting.

using Images, Colors, ImageView, Gtk.ShortNames, TestImages
myPic = testimage(“mandrill”)

guidict = imshow(myPic);

if (!isinteractive())

    # Create a condition object
    c = Condition()

    # Get the window
    win = guidict["gui"]["window"]

    # Notify the condition object when the window closes
    signal_connect(win, :destroy) do widget
        notify(c)
    end

    # Wait for the notification before proceeding ...
    wait(c)
end

Did the trick for me under linux YMMW.

To be honest I do not quite understand … and in my case the image appears in the plot pane, a window opens but stays blank.
I am using Atom and Julia 1.1.1 on a MacBook Pro under macos Mojave version 10.14.5

Thanks anyhow.

Le jeu. 18 juil. 2019 à 17:59, freemint via JuliaLang julialang@discoursemail.com a écrit :

This code works for me if i paste it in the Julia REPL or run it from a file. It tried to answer:

I just tried to run the code from a file and this time no image in the plot pane and I join the screen capture of the opened window.
I guess there is some kind of problem with Gtk on Mac …

Perhaps a Mac user will have an idea …

But aggain thanks!

Le jeu. 18 juil. 2019 à 18:49, freemint via JuliaLang julialang@discoursemail.com a écrit :

Likely a Cairo/Homebrew issue. If it fits, a possible solution is here:

https://github.com/JuliaGraphics/Cairo.jl/issues/271#issuecomment-476827465

Hummm … I doubt because it sounds like a long list of problems and no obvious solution detected in the thread!
Thanks anyhow …

Le jeu. 18 juil. 2019 à 20:24, tim.holy via JuliaLang julialang@discoursemail.com a écrit :

See the part about Homebrew.brew(``switch glib 2.58.3``)? I can’t vouch for any of this myself, since I’m on LInux.

Thanks! But very honestly it’s far beyond what I am able to understand in terms of managing the environment of my MacBook Pro … just tried to follow the advice but then I discover new errors such as failing to build Homebrew etc …
Hope somebody will find an easy and clear way to do the job.
For the moment I will just stick with visualization in the plot pane!
But thanks again!

In fact it’s really painful because I realize that it’s OK working with the Plot Pane when using ordinary images such as “mandrill” which is automatically displayed in the plot pane upon loading; but when using images such as MNIST datasets I do not see any way to visualize images …
Here is the code to concatenate the first 10 images

using MLDatasets
train_x, train_y = MNIST.traindata()
preview_img = zeros(size(train_x, 1), 0)
for i = 1 : 10
global preview_img = hcat(preview_img, train_x[:,:,i])
end

Then preview_img is 28×280 Array{Float64,2} and imshow(preview_img) opens an empty window.
I wonder how to display this preview_img in the plot pane …
All this is kind of desesperating given all what I see about the greatness of Julia in image analysis.
This could be the end of my experience with Julia …