Skip to content Skip to sidebar Skip to footer

Discord.py Send Bytesio

I am manipulating an image using Pillow, and then want to send it to Discord. My code: https://paste.pythondiscord.com/comebefupo.py When using image.show(), the manipulated image

Solution 1:

I had a similar problem last week, this was the code I used to send the image

with BytesIO() as image_binary:
             image.save(image_binary, 'PNG')
             image_binary.seek(0)
             await ctx.send(file=discord.File(fp=image_binary, filename='image.png)) 

Solution 2:

This is not a full answer but it might help.

image_file = discord.File(io.BytesIO(image_bytes.encode()),filename=f"{name}.png")
await ctx.send(file=image_file )

Post a Comment for "Discord.py Send Bytesio"