# Convert Array{UInt8, 3} to Matrix{RGB{N0f8}}

**URL:** https://discourse.julialang.org/t/convert-array-uint8-3-to-matrix-rgb-n0f8/84767
**Category:** General Usage
**Tags:** question
**Created:** [July 25, 2022, 5:15pm UTC](https://discourse.julialang.org/t/convert-array-uint8-3-to-matrix-rgb-n0f8/84767 "2022-07-25T17:15:17Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Alon\_Ben-Arieh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alon_ben-arieh/32/38256_2.png) [@Alon\_Ben-Arieh](https://discourse.julialang.org/u/Alon_Ben-Arieh)
#### Post date: [July 25, 2022, 5:15pm UTC](https://discourse.julialang.org/t/convert-array-uint8-3-to-matrix-rgb-n0f8/84767/1 "2022-07-25T17:15:17Z")

</div>

Hi all  
I have a NumPy array, representing an image, I send from a python module to a Julia function.  
The NumPy array is received in the Julia function as Array{UInt8, 3}. I need to convert it to Matrix{RGB{N0f8}}.  
How do I do that?  
Thank you all!  
Alon

---

<div class="post-metadata">

### Author: ![Alon\_Ben-Arieh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alon_ben-arieh/32/38256_2.png) [@Alon\_Ben-Arieh](https://discourse.julialang.org/u/Alon_Ben-Arieh)
#### Post date: [July 25, 2022, 5:26pm UTC](https://discourse.julialang.org/t/convert-array-uint8-3-to-matrix-rgb-n0f8/84767/2 "2022-07-25T17:26:49Z")

</div>

I found this solution:

> [@Converting a PyCall numpy ×3 Array{UInt8, 3} to RGB](https://discourse.julialang.org/t/converting-a-pycall-numpy-x3-array-uint8-3-to-rgb/70537):
>
> Hey guys, I use the NumPy per PyCall to get screenshots of my desktop. I get these images back as 1440×3440×3 Array{UInt8, 3} Discord user borodi#9175 already shared a function of him that converts this array to a BGR. opencvtojulia(abc) = BGR.(reinterpret.(N0f8,abc[:,:,3]),reinterpret.(N0f8,abc[:,:,2]),reinterpret.(N0f8,abc[:,:,1])) Because it changes a lot of colors to the wrong ones i have to fix something in it. Has somebody an idea how to get RGB images from this function or what else …

Which solved my problem perfectly.
