Custom Commands homeCustom Commands
  • Blog
  • Premium
  • Templates
  • Support
Back to blog
// blog

Discord Image Generation with Custom Commands: Image Templates

Generate dynamic images from your Discord custom commands — design rank cards, profile cards and banners once, then render them with one line of code. No image API required

Md Shahriyar Alam

an hour ago

·4 min read

Rank cards, profile cards, shop receipts, event posters — every good Discord server eventually wants its custom commands to reply with an image that changes per user. Until now, Discord image generation meant hosting your own image API or settling for plain embeds.

Not anymore. Image Templates brings dynamic image generation straight into Custom Commands: design an image once on the dashboard, mark the parts your code fills in, and render it from any Discord custom command with one line:

python
img = await render_template("rank-card", user={"name": user.username}, xp_percent=73)
add_attachment(img)

That's the whole integration. Design in the editor, render in your command, attach, done.

A real design tool, in your dashboard

The template designer is a full-screen image editor built like the design apps you already know:

  • Canvas you can trust — what you see is what the bot generates: same fonts, same masks, same filters, pixel for pixel. Hit Preview any time to see the bot's actual output.
  • Elements — text, images, progress bars, gradients, and a catalogue of 35+ vector shapes (hearts, stars, arrows, badges, speech bubbles…), each with independent fill, outline and shadow.
  • Desktop-grade editing — zoom like Canva (Ctrl+scroll), pan with Space, magnetic snap guides, rubber-band selection, group/ungroup, align and distribute, copy/paste, undo/redo, a right-click menu, and keyboard shortcuts everywhere.
  • Real image tools — true crop with aspect presets (double-click any image), flip, masks (circle, square, hexagon, star…), and one-click filter looks: Noir, Vintage, Vivid, Warm, Cold and more.

Variables: the parts your code fills in

Any text, image or progress bar can be a variable slot. Give it a name, optionally a default and a sample, and the design shows the sample while you edit.

Variables are Python-style paths, so structured data just works:

python
await render_template("profile",
    user={"name": member.display_name, "level": 42},
    badges=["🥇", "🥈"],
    avatar=str(member.display_avatar_url),
    xp_percent=87)

fills {user.name}, {user.level}, {badges[0]}, an image slot named avatar, and a progress bar bound to xp_percent.

  • Text slots take any text or number.
  • Image slots take a URL — a user's avatar, an uploaded file, anything.
  • Progress slots take 0–100 (fractions like 0.87 are understood too).
  • Slots with a default are optional; miss a required one and the error tells you exactly which names are missing.

The Variables panel even writes the render_template(...) call for you — copy, paste into your custom command, fill in the values.

Send your image anywhere

render_template returns a ready-to-send PNG attachment. Every send helper in Custom Commands accepts it, so the same rendered image works in a reply, a channel post, or a DM.

Attach it to the command's reply — the simplest case:

python
img = await render_template("rank-card", xp_percent=73)
add_attachment(img)

Post it to any channel with send_message — welcome images, level-up announcements, shop logs:

python
img = await render_template("welcome-card", name=user.username,
                            avatar=str(user.display_avatar_url))
send_message(1234567890123456789,
             content=f"Welcome {user.mention}!",
             attachments=[img])

DM it to a user with send_dm — receipts, private stat cards, reminders:

python
img = await render_template("purchase-receipt", item="Sword", price=250)
send_dm(user.id, content="Thanks for your purchase!", attachments=[img])

Combine it with embeds and components — attachments ride along with whatever else the message carries:

python
img = await render_template("event-poster", title="Movie Night", when="Friday 8pm")
send_message(channel_id,
             message=Message(title="📅 New event!", description="React to join"),
             attachments=[img])

One render, any destination. You can render up to two templates per command execution, so a command can, say, reply with a public card and DM a private one.

Build a Discord rank card in five minutes

  1. Open Dashboard → Image Templates → New template, name it rank-card.
  2. Set the canvas to 1024 × 400 and drop in a background from your media library.
  3. Add an image, pick Placeholder, and name it avatar. Give it a circle mask and a border.
  4. Add a text element: {user.name} · Level {level}.
  5. Add a progress bar and bind its value to xp_percent.
  6. Hit Preview to see the bot render it, then Save.

In your custom command:

python
img = await render_template("rank-card",
    user={"name": user.username},
    level=member_var("level"),
    xp_percent=member_var("xp_percent"),
    avatar=str(user.display_avatar_url))
add_attachment(img)

Run the command. Your Discord server has rank cards now — no external rank card generator, no image API, no hosting.

Limits

  • Templates per server: 5 free, up to 100 on premium tiers — same ladder as slash commands.
  • Images per template: 5 free, 15 premium.
  • Renders per command execution: 2.
  • Canvas up to 1024 × 1024. (Discord shows attachments at about 550px wide, so bigger isn't always better.)

Start designing

Head to Dashboard → Image Templates, start from a blank canvas, and make something your members will screenshot. The AI builder knows render_template too — describe the Discord custom command you want and it will wire the image generation up for you.

Loading comments…

{}

Need help?

Have a question, a suggestion, or stuck on something? Reach out — we're happy to help.

Join support server
Custom CommandsCustom Commands

The #1 custom commands Discord bot — build commands, events and databases with zero boilerplate.

Links

HomeBlogPrivacySupport

Contact

[email protected]

2 Frederick StreetLondon, WC1X 0ND

{ / } custom commands

© WEiRDSOFT LTD. All rights reserved.