1
您好我有以下代码返回GIF图像(图像不会在浏览器动画)
@hug.get('/getgif', output=hug.output_format.image('gif'))
def get(username: str, password: str):
dir_path = os.path.dirname(__file__)
img_path = os.path.join(dir_path, 'animation.gif')
img = Image.open(img_path)
return img
我使用的拥抱,python3和PIL创建响应。返回到我的浏览器的图像完全没有提及。我猜测PIL只需要GIF图像的第一帧并返回。有没有其他方法可以将整个GIF图像传输回浏览器?