我正在尝试在Hug / python 中创建一个图像上传实用程序,并希望保存图像和 gif。但是在上传一些 gif 图像时,gif 图像似乎有很多像素化。下面给出的是我在上传实用程序中使用的代码片段。
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)