I am trying to create an image upload utility in Hug / python and wanted to save images and gifs. But on uploading some of the gif images, the gif images seem to be a lot pixelated. Given below is the code snippet that I am using in the upload utility.
image = Image.open(io.BytesIO(file))
frames = [frame.copy() for frame in ImageSequence.Iterator(image)]
image.save(media_location, save_all=True, append_images=frames)