# Geting the image pixel using ImageView

**URL:** https://discourse.julialang.org/t/geting-the-image-pixel-using-imageview/44555
**Category:** Visualization
**Tags:** images, gtk
**Created:** [August 8, 2020, 8:15am UTC](https://discourse.julialang.org/t/geting-the-image-pixel-using-imageview/44555 "2020-08-08T08:15:08Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![kobied](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kobied/32/16432_2.png) [@kobied](https://discourse.julialang.org/u/kobied)
#### Post date: [August 8, 2020, 8:15am UTC](https://discourse.julialang.org/t/geting-the-image-pixel-using-imageview/44555/1 "2020-08-08T08:15:08Z")

</div>

Hello,  
I need to create a gui which has an image and some controllers.  
I’m using Gtk and ImageView, my quastion is, how can i get the image pixle that the mouse courser is clicked on?

Thanks in ahead

---

<div class="post-metadata">

### Author: ![NightMachinary](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nightmachinary/32/14196_2.png) [@NightMachinary](https://discourse.julialang.org/u/NightMachinary)
#### Post date: [August 8, 2020, 10:09am UTC](https://discourse.julialang.org/t/geting-the-image-pixel-using-imageview/44555/2 "2020-08-08T10:09:55Z")

</div>

I don’t know, but I’d look at GtkReactive’s docs.

---

<div class="post-metadata">

### Author: ![kobied](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kobied/32/16432_2.png) [@kobied](https://discourse.julialang.org/u/kobied)
#### Post date: [August 8, 2020, 10:54am UTC](https://discourse.julialang.org/t/geting-the-image-pixel-using-imageview/44555/3 "2020-08-08T10:54:14Z")

</div>

hi, after some sourcing I found the solution:

```julia
# loading the needed pkg
using ImageView, TestImages

# choosing image to show
img = float.(testimage("lighthouse"))
s = imshow(img)

# this is the main idea, in the s object under the dictionary key "gui" then "canvas" there is a 
# mouse Signal object which has several actions, one of them is buttonpress, in this example 
# i map the Signal when the mouse button pressed to the println function which print the
# mouse [x,y] position 
mouse_pos = map(d->println("x = $(float(d.position.x)), y = $(float(d.position.y))"),s["gui"]["canvas"].mouse.buttonpress)

```

---

<div class="post-metadata">

### Author: ![NightMachinary](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nightmachinary/32/14196_2.png) [@NightMachinary](https://discourse.julialang.org/u/NightMachinary)
#### Post date: [August 8, 2020, 6:43pm UTC](https://discourse.julialang.org/t/geting-the-image-pixel-using-imageview/44555/4 "2020-08-08T18:43:13Z")

</div>

I was reading Mackie’s docs, and it also has this feature: [https://makie.juliaplots.org/stable/interaction.html#Interaction-using-the-mouse](https://makie.juliaplots.org/stable/interaction.html#Interaction-using-the-mouse)

---

<div class="post-metadata">

### Author: ![kobied](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kobied/32/16432_2.png) [@kobied](https://discourse.julialang.org/u/kobied)
#### Post date: [August 8, 2020, 6:59pm UTC](https://discourse.julialang.org/t/geting-the-image-pixel-using-imageview/44555/5 "2020-08-08T18:59:50Z")

</div>

I’m familiar with the Makie interaction with mouse, but unforchenetly it lackes the other gui features that Gtk has so i can’t use it.  
As i note earlier, i’m using Gtk and there for i need to use ImagView with it.
