0

我正在尝试使用 PIL 将我的图像从 rgba 转换为 rgb,然后使用Color-Thief-Py检测最常用的颜色。但是,当我尝试将 rgb 转换后的图像传递给 colorthief 函数时,出现以下错误AttributeError: read

这是代码:

logo = request.FILES.get('logo')
rgba_img = Image.open(logo)
rgb_img = rgba_img.convert('RGB')
color = io.BytesIO(rgb_img.read()) #AttributeError: read
color_thief = ColorThief(color)

我做错了什么&我该如何解决?

4

0 回答 0