# Trouble displaying an image using ImageView.imshow()

**URL:** <https://discourse.julialang.org/t/trouble-displaying-an-image-using-imageview-imshow/26493>\
**Category:** Visualization\
**Created:** [July 18, 2019, 9:23am UTC](https://discourse.julialang.org/t/trouble-displaying-an-image-using-imageview-imshow/26493 "2019-07-18T09:23:41Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Didier\_Chatenay](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/didier_chatenay/32/8862_2.png) [@Didier\_Chatenay](https://discourse.julialang.org/u/Didier_Chatenay)\
**Post date:** [July 18, 2019, 9:23am UTC](https://discourse.julialang.org/t/trouble-displaying-an-image-using-imageview-imshow/26493/1 "2019-07-18T09:23:41Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [July 18, 2019, 2:40pm UTC](https://discourse.julialang.org/t/trouble-displaying-an-image-using-imageview-imshow/26493/2 "2019-07-18T14:40:35Z")

</div>

It works here (without the third line).

 ![03](https://global.discourse-cdn.com/julialang/original/3X/8/4/844ac024e2178797088530176f4acc8ba7a51b76.jpeg)

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

---

<div class="post-metadata">

**Author:** ![Didier\_Chatenay](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/didier_chatenay/32/8862_2.png) [@Didier\_Chatenay](https://discourse.julialang.org/u/Didier_Chatenay)\
**Post date:** [July 18, 2019, 3:28pm UTC](https://discourse.julialang.org/t/trouble-displaying-an-image-using-imageview-imshow/26493/3 "2019-07-18T15:28:03Z")

</div>

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](mailto:julialang@discoursemail.com) a écrit :

---

<div class="post-metadata">

**Author:** ![freemint](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freemint/32/20013_2.png) [@freemint](https://discourse.julialang.org/u/freemint)\
**Post date:** [July 18, 2019, 3:54pm UTC](https://discourse.julialang.org/t/trouble-displaying-an-image-using-imageview-imshow/26493/4 "2019-07-18T15:54:42Z")

</div>

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

```julia
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.

---

<div class="post-metadata">

**Author:** ![Didier\_Chatenay](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/didier_chatenay/32/8862_2.png) [@Didier\_Chatenay](https://discourse.julialang.org/u/Didier_Chatenay)\
**Post date:** [July 18, 2019, 4:21pm UTC](https://discourse.julialang.org/t/trouble-displaying-an-image-using-imageview-imshow/26493/5 "2019-07-18T16:21:23Z")

</div>

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](mailto:julialang@discoursemail.com) a écrit :

---

<div class="post-metadata">

**Author:** ![freemint](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freemint/32/20013_2.png) [@freemint](https://discourse.julialang.org/u/freemint)\
**Post date:** [July 18, 2019, 4:44pm UTC](https://discourse.julialang.org/t/trouble-displaying-an-image-using-imageview-imshow/26493/6 "2019-07-18T16:44:20Z")

</div>

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

> [@Didier\_Chatenay](#):
>
> Any idea about a way to have the display outside Atom?

---

<div class="post-metadata">

**Author:** ![Didier\_Chatenay](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/didier_chatenay/32/8862_2.png) [@Didier\_Chatenay](https://discourse.julialang.org/u/Didier_Chatenay)\
**Post date:** [July 18, 2019, 5:06pm UTC](https://discourse.julialang.org/t/trouble-displaying-an-image-using-imageview-imshow/26493/7 "2019-07-18T17:06:47Z")

</div>

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](mailto:julialang@discoursemail.com) a écrit :

 ![Capture d’écran 2019-07-18 à 19.04.23.png](https://global.discourse-cdn.com/julialang/original/3X/1/b/1bb403d4872b4a37c19c50cb2ccff6fd234bc3c5.png)

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [July 18, 2019, 6:19pm UTC](https://discourse.julialang.org/t/trouble-displaying-an-image-using-imageview-imshow/26493/8 "2019-07-18T18:19:37Z")

</div>

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

[https://github.com/JuliaGraphics/Cairo.jl/issues/271#issuecomment-476827465](https://github.com/JuliaGraphics/Cairo.jl/issues/271#issuecomment-476827465)

---

<div class="post-metadata">

**Author:** ![Didier\_Chatenay](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/didier_chatenay/32/8862_2.png) [@Didier\_Chatenay](https://discourse.julialang.org/u/Didier_Chatenay)\
**Post date:** [July 18, 2019, 6:39pm UTC](https://discourse.julialang.org/t/trouble-displaying-an-image-using-imageview-imshow/26493/9 "2019-07-18T18:39:37Z")

</div>

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](mailto:julialang@discoursemail.com) a écrit :

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [July 19, 2019, 1:15am UTC](https://discourse.julialang.org/t/trouble-displaying-an-image-using-imageview-imshow/26493/10 "2019-07-19T01:15:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Didier\_Chatenay](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/didier_chatenay/32/8862_2.png) [@Didier\_Chatenay](https://discourse.julialang.org/u/Didier_Chatenay)\
**Post date:** [July 19, 2019, 8:53am UTC](https://discourse.julialang.org/t/trouble-displaying-an-image-using-imageview-imshow/26493/11 "2019-07-19T08:53:00Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Didier\_Chatenay](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/didier_chatenay/32/8862_2.png) [@Didier\_Chatenay](https://discourse.julialang.org/u/Didier_Chatenay)\
**Post date:** [July 19, 2019, 9:28am UTC](https://discourse.julialang.org/t/trouble-displaying-an-image-using-imageview-imshow/26493/12 "2019-07-19T09:28:21Z")

</div>

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 …
