i have the following code in python to mask the image
def create_mask(img, 255): img = img < 255 return np.uint8(255 - img * 255.)