# Grayshade image into 3d array

**URL:** <https://discourse.julialang.org/t/grayshade-image-into-3d-array/109701>\
**Category:** New to Julia\
**Tags:** images\
**Created:** [February 4, 2024, 3:29pm UTC](https://discourse.julialang.org/t/grayshade-image-into-3d-array/109701 "2024-02-04T15:29:11Z")\
**Posts on this page:** 1\
**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:** [February 4, 2024, 3:29pm UTC](https://discourse.julialang.org/t/grayshade-image-into-3d-array/109701/1 "2024-02-04T15:29:11Z")

</div>

I have this code, where I’m trying to apply a filter to an image based on another one. img is an rgb image and joint\_image is a grayshade image, I need to make the grayshade image into a 3d array, that’s why I’m using channelview, but when applied to a grayscale image it does not change.  
‘’’  
I = float.(channelview(img))  
if joint\_image !== nothing  
J = float.(channelview(joint\_image))  
if size(I, 2) !== size(J, 2) || size(I, 3) !== size(J, 3)  
error(“Input and joint images must have equal width and height.”)  
end  
else  
J = I  
end  
‘’’
