为了账号安全,请及时绑定邮箱和手机立即绑定

discord py,尝试发送图像

discord py,尝试发送图像

慕桂英3389331 2022-07-26 10:57:37
试图发送图像从帖子中复制了这段代码,我添加了一些。ch = get(member.guild.channels, name="general")# where i want to send an image #this is my animated gif from this line I copied but no idea where Image function come from image = Image.open("./images/welcome.gif")with BytesIO() as image_binary:   image.save(image_binary, "gif")   image_binary.seek(0)   await ch.send(file=discord.File(fp=image_binary))我通过 pip 安装了 Image 并添加了 import Image 然后出现错误所以我认为这不是来自 pip 的模块有任何想法吗?
查看完整描述

1 回答

?
陪伴而非守候

TA贡献1757条经验 获得超8个赞

你会想要Pillow图书馆。

pip install Pillow

Image然后,从导入PIL

from PIL import Image


查看完整回答
反对 回复 2022-07-26
  • 1 回答
  • 0 关注
  • 72 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号