Solved by zilong in post #2 
              
              
                I think you should convert the image to the right format using PIL could be the solution: 
from PIL import Image

img = Image.open(img_path)

# converts to 4 channels, where A represents the alpha/transparent channel
img.convert(RGBA)