# Undo channelview command

**URL:** <https://discourse.julialang.org/t/undo-channelview-command/109070>\
**Category:** New to Julia\
**Tags:** images\
**Created:** [January 21, 2024, 4:38pm UTC](https://discourse.julialang.org/t/undo-channelview-command/109070 "2024-01-21T16:38:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Afonso\_Britto](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/afonso_britto/32/205972_2.png) [@Afonso\_Britto](https://discourse.julialang.org/u/Afonso_Britto)\
**Post date:** [January 21, 2024, 4:38pm UTC](https://discourse.julialang.org/t/undo-channelview-command/109070/1 "2024-01-21T16:38:29Z")

</div>

I’m using Julia for a image processing program and I had to use the channelview command to acess the channels. But I’m wondering if there is any chance I can undo the command. What I want is J to be back to type Matrix{RGB{N0f8}}.  
‘’’

> J = channelview(img)  
> ‘’’

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [January 21, 2024, 5:12pm UTC](https://discourse.julialang.org/t/undo-channelview-command/109070/2 "2024-01-21T17:12:30Z")

</div>

Do you want [`Base.parent`](https://docs.julialang.org/en/v1/base/arrays/#Base.parent) ?

```julia-repl
julia> using ImageCore

julia> img = rand(RGB, 2,2)
2×2 Array{RGB{Float64},2} with eltype RGB{Float64}:
 RGB{Float64}(0.482138,0.987989,0.187547) … RGB{Float64}(0.670861,0.998297,0.294064)
 RGB{Float64}(0.238936,0.226647,0.553525) RGB{Float64}(0.0945124,0.77229,0.942222)

julia> cv = channelview(img)
3×2×2 reinterpret(reshape, Float64, ::Array{RGB{Float64},2}) with eltype Float64:
[:, :, 1] =
 0.482138 0.238936
 0.987989 0.226647
 0.187547 0.553525

[:, :, 2] =
 0.670861 0.0945124
 0.998297 0.77229
 0.294064 0.942222

julia> parent(cv)
2×2 Array{RGB{Float64},2} with eltype RGB{Float64}:
 RGB{Float64}(0.482138,0.987989,0.187547) … RGB{Float64}(0.670861,0.998297,0.294064)
 RGB{Float64}(0.238936,0.226647,0.553525) RGB{Float64}(0.0945124,0.77229,0.942222)

```

---

<div class="post-metadata">

**Author:** ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Post date:** [April 16, 2025, 4:22pm UTC](https://discourse.julialang.org/t/undo-channelview-command/109070/3 "2025-04-16T16:22:20Z")

</div>

The answer is [`colorview`](https://juliaimages.org/ImageCore.jl/stable/reference/#ImageCore.colorview)

(Sorry for replying to such an old thread, but I think that `parent` is a bit of a hack, so it shouldn’t be left as the only answer.)
