# Imread not defined

**URL:** <https://discourse.julialang.org/t/imread-not-defined/1825>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [February 1, 2017, 6:40pm UTC](https://discourse.julialang.org/t/imread-not-defined/1825 "2017-02-01T18:40:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rushirg](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@rushirg](https://discourse.julialang.org/u/rushirg)\
**Post date:** [February 1, 2017, 6:40pm UTC](https://discourse.julialang.org/t/imread-not-defined/1825/1 "2017-02-01T18:40:49Z")

</div>

I am getting error like this:  
**ERROR: LoadError: UndefVarError: imread not defined**  
**in read\_data(::String, ::DataFrames.DataFrame, ::Int32, ::String) at FileLocation**  
Below is my code

```julia
nameFile = "$(path)/$(typeData)/$(idImage).Bmp"
  img = imread(nameFile)

```

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [February 1, 2017, 6:43pm UTC](https://discourse.julialang.org/t/imread-not-defined/1825/2 "2017-02-01T18:43:08Z")

</div>

Are you using the Images package? Have you installed it with `Pkg.add("Images")` and declared that you’re using it with `using Images`?

---

<div class="post-metadata">

**Author:** ![rushirg](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@rushirg](https://discourse.julialang.org/u/rushirg)\
**Post date:** [February 5, 2017, 2:18pm UTC](https://discourse.julialang.org/t/imread-not-defined/1825/3 "2017-02-05T14:18:26Z")

</div>

Yes, i have added that in my code on the first line.

---

<div class="post-metadata">

**Author:** ![tkelman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkelman/32/692_2.png) [@tkelman](https://discourse.julialang.org/u/tkelman)\
**Post date:** [February 5, 2017, 4:27pm UTC](https://discourse.julialang.org/t/imread-not-defined/1825/4 "2017-02-05T16:27:42Z")

</div>

It looks like `imread` is gone in Images 0.6 (replaced by `load`). It was supposed to give a deprecation warning in Images 0.5.x.

---

<div class="post-metadata">

**Author:** ![rushirg](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@rushirg](https://discourse.julialang.org/u/rushirg)\
**Post date:** [February 6, 2017, 4:03pm UTC](https://discourse.julialang.org/t/imread-not-defined/1825/5 "2017-02-06T16:03:32Z")

</div>

Yeah! `imread` was deprecated `load` works fine in that place. But after changing that now i am getting  
`ERROR: LoadError: type Array has no field data in read_data(::String, ::DataFrames.DataFrame, ::Int32, ::String)` at file\_path  
The code is as follows:

```julia
xTrain = read_data("train", labelsInfoTrain, imageSize, path)

```

in which imageSize = 400, path = folder location, labelsInfoTrain = result after reading` .csv` file by `readtable` function

---

<div class="post-metadata">

**Author:** ![tkelman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkelman/32/692_2.png) [@tkelman](https://discourse.julialang.org/u/tkelman)\
**Post date:** [February 7, 2017, 11:36pm UTC](https://discourse.julialang.org/t/imread-not-defined/1825/6 "2017-02-07T23:36:06Z")

</div>

Where is the function `read_data` from?

---

<div class="post-metadata">

**Author:** ![rsrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rsrock/32/115_2.png) [@rsrock](https://discourse.julialang.org/u/rsrock)\
**Post date:** [February 8, 2017, 12:25am UTC](https://discourse.julialang.org/t/imread-not-defined/1825/7 "2017-02-08T00:25:59Z")

</div>

The old `Image` type had a field called `data`, which held the pixel data. The new images uses plain `AbstractArray`s, so you may need to modify your code so it doesn’t use `fooimg.data`.

More info is available here: [http://juliaimages.github.io/latest/quickstart.html#Images-are-just-arrays-1](http://juliaimages.github.io/latest/quickstart.html#Images-are-just-arrays-1)

---

<div class="post-metadata">

**Author:** ![Carlos\_Filho](https://avatars.discourse-cdn.com/v4/letter/c/e47774/32.png) [@Carlos\_Filho](https://discourse.julialang.org/u/Carlos_Filho)\
**Post date:** [February 15, 2017, 7:51pm UTC](https://discourse.julialang.org/t/imread-not-defined/1825/8 "2017-02-15T19:51:27Z")

</div>

What is the command line that I should put in place to imread?

---

<div class="post-metadata">

**Author:** ![rsrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rsrock/32/115_2.png) [@rsrock](https://discourse.julialang.org/u/rsrock)\
**Post date:** [February 15, 2017, 8:56pm UTC](https://discourse.julialang.org/t/imread-not-defined/1825/9 "2017-02-15T20:56:20Z")

</div>

The replacement for `imread()` is `load()`. Depending on your platform, `load()` will use ImageMagick.jl or QuartzImageIO.jl (on a Mac) behind the scenes.
