in this demo color is not changed : https://huggingface.co/spaces/KenjieDec/RemBG
So here my method
def remove_background(image_path):
# Read the input image
input_image = cv2.imread(image_path, cv2.IMREAD_UNCHANGED)
# Remove the background
output_image = remove(input_image, alpha_matting=True, alpha_matting_erode_size=10)
output_image_pil = Image.fromarray(output_image)
return output_image_pil
. . .
image = remove_background(file_path)
image.save(save_file_path)
here input png. it has white background
here output png. background removed but the color tone is changed