1

I want tomake a command that basically takes an image that the user sent. I'm using the pillow library.

@bot.command(pass_context=True)
async def task(ctx):
    userimg = attachment.url[0].url
    print(userimg.size)
    background = Image.open("task_failed.jpg")
    print(background.size)
    size = (640,2030)
    background = background.resize(size,Image.ANTIALIAS)
    background.paste(userimg, (0, 0), userimg)
    background.save('memetask',"PNG")

How am I supposed to complete this?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
HijakTheMiner
  • 53
  • 2
  • 7
  • Does this answer your question? [How to save an image locally using Python whose URL address I already know?](https://stackoverflow.com/questions/8286352/how-to-save-an-image-locally-using-python-whose-url-address-i-already-know) – chluebi May 13 '20 at 09:26
  • no, im trying to paste an image that the user sent above the image that i configured using Pillow – HijakTheMiner May 13 '20 at 09:33
  • 1
    As you have the url of the attached image, you are able to save it with the question you sent. Note that there is also an in-built save function: https://discordpy.readthedocs.io/en/latest/api.html#discord.Attachment.save I can't help you with PIL in itself. – chluebi May 13 '20 at 09:46
  • Firstly, welcome to Stack Overflow! Secondly, what version of dpy are you using? pass_context is quite old when it comes to the latest versions. – Generic Nerd May 14 '20 at 11:16

0 Answers0