# RGB values of a pixel

**URL:** <https://discourse.julialang.org/t/rgb-values-of-a-pixel/52168>\
**Category:** New to Julia\
**Created:** [December 21, 2020, 12:37pm UTC](https://discourse.julialang.org/t/rgb-values-of-a-pixel/52168 "2020-12-21T12:37:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aitotelic](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aitotelic/32/20408_2.png) [@Aitotelic](https://discourse.julialang.org/u/Aitotelic)\
**Post date:** [December 21, 2020, 12:38pm UTC](https://discourse.julialang.org/t/rgb-values-of-a-pixel/52168/1 "2020-12-21T12:38:00Z")

</div>

RGB(a, b, c) gives us a pixel. How do I input a pixel and extract the RGB components?

---

<div class="post-metadata">

**Author:** ![feanor12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/feanor12/32/8212_2.png) [@feanor12](https://discourse.julialang.org/u/feanor12)\
**Post date:** [December 21, 2020, 1:11pm UTC](https://discourse.julialang.org/t/rgb-values-of-a-pixel/52168/2 "2020-12-21T13:11:08Z")

</div>

This might contain the information you need to tackle your problem.  
[https://github.com/JuliaGraphics/ColorTypes.jl](https://github.com/JuliaGraphics/ColorTypes.jl)

There are getters for the type, but you could also access the fields of the type directly.

`green(c::AbstractRGB ) = c.g`

---

<div class="post-metadata">

**Author:** ![Aitotelic](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aitotelic/32/20408_2.png) [@Aitotelic](https://discourse.julialang.org/u/Aitotelic)\
**Post date:** [December 22, 2020, 1:26am UTC](https://discourse.julialang.org/t/rgb-values-of-a-pixel/52168/3 "2020-12-22T01:26:18Z")

</div>

Thank you. I think I found my answer:

using accessor functions:

```julia
julia> c = imgc[1,1]; (red(c), green(c), blue(c))
(0.7550899f0,0.9650581f0,0.65485954f0)

```
