# Image manipulation in Julia

**URL:** https://discourse.julialang.org/t/image-manipulation-in-julia/1188
**Category:** New to Julia
**Tags:** package, images
**Created:** [December 28, 2016, 3:56pm UTC](https://discourse.julialang.org/t/image-manipulation-in-julia/1188 "2016-12-28T15:56:53Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sim4life](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sim4life/32/339_2.png) [@sim4life](https://discourse.julialang.org/u/sim4life)
#### Post date: [December 28, 2016, 3:56pm UTC](https://discourse.julialang.org/t/image-manipulation-in-julia/1188/1 "2016-12-28T15:56:53Z")

</div>

I’ve been programming for more than a decade but I’m new to Julia lang and Computer Vision in general. I’ve _Julia_ language, _Jupyter_ notebooks and _Juno/Atom_ IDE environment setup and running. However, I’m finding it difficult to get basic Computer Vision tasks done using Julia lang. **Can somebody suggest any Julia tutorials/books for image processing?**  
Computer Vision courses online either make use of _Matlab/Octave_ syntax or _Python_ or _C++_ for image/video processing. I’m finding it very difficult to find tutorials to do Computer Vision tasks in Julia lang idiomatic image/video processing. Say for example

````nohighlight
imgreen = im(:,:,2)```

The above Matlab code takes the green channel out of the loaded `peppers.png` image. **How can this be done in idiomatic Julia lang without converting loaded image to an array?**
````

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [December 28, 2016, 4:13pm UTC](https://discourse.julialang.org/t/image-manipulation-in-julia/1188/2 "2016-12-28T16:13:22Z")

</div>

See [https://github.com/timholy/Images.jl](https://github.com/timholy/Images.jl)

If I remember correctly, I think you can do

```julia
using Images
im = imread("peppers.png")
imgreen = map(c -> c.g, im)

```

to extract the green channel of an RGB image.

---

<div class="post-metadata">

### Author: ![oatlzzvztd](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oatlzzvztd/32/3285_2.png) [@oatlzzvztd](https://discourse.julialang.org/u/oatlzzvztd)
#### Post date: [December 28, 2016, 4:17pm UTC](https://discourse.julialang.org/t/image-manipulation-in-julia/1188/3 "2016-12-28T16:17:19Z")

</div>

`imgreen = map(ColorTypes.green, im)` would also do the trick, and is a bit more legible.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [December 28, 2016, 4:24pm UTC](https://discourse.julialang.org/t/image-manipulation-in-julia/1188/4 "2016-12-28T16:24:48Z")

</div>

You could also do `imgreen = ColorTypes.green.(im)` (a 0.5-style vectorized “dot call”).

---

<div class="post-metadata">

### Author: ![Evizero](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evizero/32/10118_2.png) [@Evizero](https://discourse.julialang.org/u/Evizero)
#### Post date: [December 28, 2016, 4:29pm UTC](https://discourse.julialang.org/t/image-manipulation-in-julia/1188/5 "2016-12-28T16:29:03Z")

</div>

As a site note:

In near future, with the new and shiny images ecosystem, this will be a little nicer still using `channelview`. see [Views · ImageCore](https://juliaimages.github.io/ImageCore.jl/latest/views.html#View-types-defined-in-ImageCore-1)

you can try out the new way by following this discussion: [https://github.com/timholy/Images.jl/issues/542#issuecomment-254059092](https://github.com/timholy/Images.jl/issues/542#issuecomment-254059092)

More documentation for the new ecosystem: [Home · JuliaImages](http://juliaimages.github.io/latest/index.html)
