# Check for element type inside a module (Images)

**URL:** <https://discourse.julialang.org/t/check-for-element-type-inside-a-module-images/26085>\
**Category:** General Usage\
**Tags:** question, images, type, module\
**Created:** [July 7, 2019, 2:05am UTC](https://discourse.julialang.org/t/check-for-element-type-inside-a-module-images/26085 "2019-07-07T02:05:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amin\_Yahyaabadi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amin_yahyaabadi/32/9826_2.png) [@Amin\_Yahyaabadi](https://discourse.julialang.org/u/Amin_Yahyaabadi)\
**Post date:** [July 7, 2019, 2:05am UTC](https://discourse.julialang.org/t/check-for-element-type-inside-a-module-images/26085/1 "2019-07-07T02:05:47Z")

</div>

I am trying to check the type of the elements of an image that is passed to a function which is inside a module.

Consider[I define img as follows:](https://github.com/aminya/MatlabCompat.jl/blob/b944e33b99a6bcb739cd9ca68b2d29f3dbe5600e/test/runtests.jl#L38)

```julia
using Images
img = colorview(Gray, array);

```

Then [inside the function in my module:](https://github.com/aminya/MatlabCompat.jl/blob/b944e33b99a6bcb739cd9ca68b2d29f3dbe5600e/src/MatlabCompat/imagetools.jl#L61)

```julia
import Images
eltype(img) in [Gray{Float64}, Gray{Float32}, Gray{Float16}]

```

But I get an error that `Gray` is not defined.

**I have two questions:**

1. How can I import an element type into my module?  
(I am not writing `using Images` in my module)

2. How can I check if the element type is `Gray`?  
(I do not care about number type `Gray{Any type here is fine}`)

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [July 7, 2019, 3:37am UTC](https://discourse.julialang.org/t/check-for-element-type-inside-a-module-images/26085/2 "2019-07-07T03:37:55Z")

</div>

1. `using Images: Gray`

2. `eltype(img) <: Gray`
