Save image issue after converting 2d to 3d array

I convert 2d array(arr2d) to 3d array(arr3d) and save as image using below code. arr2d is float64 type. Why save image is not color image?

arr3d[:, :, 0] = arr3d[:, :, 1] = arr3d[:, :, 2] = arr2d
arr3d=arr3d*255
im=Image.fromarray(np.maximum(np.minimum(arr3d, 255), 0).astype(np.uint8))
im.save(“sample.png”)

This dummy code produces a color image:

x = np.random.randn(224, 224, 3).astype(np.float64)
x = x * 255
x = np.clip(x, 0, 255)
img = Image.fromarray(x.astype(np.uint8))

Could you check that your color channels have different values?

Okay. Thats i want. Thank You.