Help with canvas-constructor

Hey, I’ve been trying to program a simple leveling bot for my server and I just cant seem to get the profile card to take a picture (off the internet), using a URL and put it as the profile’s background, if anyone has any knowledge on how am I supposed to do that please leave a message here either explaining or giving an example of it

of course if someone knows there is no way of doing that, I’d appreciate if you can tell me haha, cause its been driving me crazy for like a week now

Thank you!

Do you need image processing?

If you want your bot take a picture from the cloud, write text above and respond that new picture into your discord server, maybe this is the best choice. It is a very nice library and a lot of people use it so should be easier to find help.

I cant really seem to understand how to use it, could you maybe give an example?

Use canvas - and add your card file (png) in assets.

how would I use it? in assets, just as like ./filename ?

Its not working like .filename - coppy the cdn link and use it.

could you please give an example on how would I write that in code?
I’m just really frustrated at trying lots of ways to do this

const canvas = Canvas.createCanvas(700, 200); const ctx = canvas.getContext('2d'); const background = await Canvas.loadImage('https://cdn.glitch.com/af4490e7-0689-40d5-9466-8c9981c8eeed%2Fcard%20(1).png?1557767872706'); ctx.drawImage(background, 0, 0, canvas.width, canvas.height);

do you know if there is a way I could do that with canvas-constructor?

1 Like

thank you very much
you helped me a lot