Could we use skimage.util.img_as_ubyte here?