Try to explicilitly convert it to img_as_float or img_as_ubyte.