You can just make a copy of the original image and then replace the channels of the copy with your RGB produced.
For Example:
img_cpy =img.copy()
img_cpy[:,:,0]=r
img_cpy[:,:,1]=g
img_cpy[:,:,2]=b
Make sure the shapes do match.
CLICK HERE to find out more related problems solutions.