mmm
mmm

Reputation: 11

discord py, try to send an image

trying to send an image so

copied this code from a post and i added some.

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))

I installed Image through pip and added import Image then got error

so I think that is not the module from pip

any ideas?

Upvotes: 0

Views: 232

Answers (1)

AKX
AKX

Reputation: 168834

You'll want the Pillow library.

pip install Pillow

Then, import Image from PIL:

from PIL import Image

Upvotes: 1

Related Questions