# Is there a function to extract the y-channel (=luminance) of an image in julia?

**URL:** <https://discourse.julialang.org/t/is-there-a-function-to-extract-the-y-channel-luminance-of-an-image-in-julia/31936>\
**Category:** General Usage\
**Tags:** images\
**Created:** [December 6, 2019, 5:29pm UTC](https://discourse.julialang.org/t/is-there-a-function-to-extract-the-y-channel-luminance-of-an-image-in-julia/31936 "2019-12-06T17:29:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![patdax](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@patdax](https://discourse.julialang.org/u/patdax)\
**Post date:** [December 6, 2019, 5:29pm UTC](https://discourse.julialang.org/t/is-there-a-function-to-extract-the-y-channel-luminance-of-an-image-in-julia/31936/1 "2019-12-06T17:29:12Z")

</div>

I am trying to extract the y channel of a rgb image and asking myself if there are some packages available for that?

---

<div class="post-metadata">

**Author:** ![tamasgal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamasgal/32/27946_2.png) [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Post date:** [December 6, 2019, 5:37pm UTC](https://discourse.julialang.org/t/is-there-a-function-to-extract-the-y-channel-luminance-of-an-image-in-julia/31936/2 "2019-12-06T17:37:44Z")

</div>

What kind of brightness do you mean? There are different types…

The “standard” luminance is

```julia
Y = 0.2126R + 0.7152G + 0.0722B

```

Here is more information: [Relative luminance - Wikipedia](https://en.wikipedia.org/wiki/Relative_luminance)

To get started with reading the images, you can check [https://juliaimages.org/latest/quickstart/#](https://juliaimages.org/latest/quickstart/#)

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [December 6, 2019, 5:40pm UTC](https://discourse.julialang.org/t/is-there-a-function-to-extract-the-y-channel-luminance-of-an-image-in-julia/31936/3 "2019-12-06T17:40:10Z")

</div>

In Images.jl, there is `imgg = Gray.(img)` which does what you want.
