Thanks Laurent!
I have tried this but my problem was that I was not getting the same information as the C++ code for the same image. I have a TIFF image with indexed colors, the C++ code gives me image.channels() = 1, and Python image.shape = [h, w, 3].