How to Generate Event Marketing Graphics in Any Size from a Single Template Using Bannerbear (Node.js Tutorial)

Learn how to use Bannerbear's adaptive templates to automatically generate event marketing images in multiple sizes from a single template. No manual resizing or repositioning required.
by Josephine Loo ·

Contents

    Promoting an event requires creating visuals in different sizes—an Instagram story, a Facebook post, an X banner, a website hero, and maybe a printed flyer on top of that. Each platform has its own required dimensions and resizing them manually eats up time that could be spent on more important things.

    If you're building an event management app or anything where users design promotional materials, here's something you can offer them: instead of asking users to resize their designs for every format themselves, you can use Bannerbear's API on the backend to handle it automatically, generating the right dimensions for Instagram, Facebook, Twitter/X, and more in one go.

    Bannerbear's Adaptive Templates feature lets you design once and generate images at any size automatically. In this tutorial, we'll walk through how to set up an adaptive template in Bannerbear, configure the adaptive settings for each layer, and then use its API to generate event assets at multiple sizes programmatically:

    Screenshot 2026-06-02 at 10.20.40 AM.png

    We'll be writing a Node.js script to demonstrate this, but the same logic applies regardless of language. Just adapt the script we use in this tutorial to fit your own project.

    Note: The adaptive sizing feature is only available in Bannerbear v5, which is currently not open to the public yet. Stay tuned for updates on when it becomes available!

    What Are Adaptive Templates?

    Adaptive Templates are a feature in Bannerbear V5 that let you define rules for how each layer in your design repositions and resizes automatically when you request a different canvas size via the API.

    Instead of creating and maintaining separate templates for every dimension, you design one template and configure rules that tell Bannerbear how each object should behave when the canvas grows or shrinks.

    Pre-requisites

    To follow along with this tutorial, you'll need:

    🐻 Bear Tip: For reference, this tutorial uses Node.js v25+.

    How to Generate Event Marketing Graphics in Any Size from a Single Template Using Bannerbear

    Step 1. Design Your Template in the Bannerbear Editor

    Open the  Bannerbear template editor and build your event poster at its base size. In our example, we're working with a social media post template at 800 × 800px:

    Screenshot 2026-06-01 at 4.32.03 PM.png

    Once your design looks good at the base size, it's time to configure the adaptive settings for each layer.

    Step 2. Configure Adaptive Settings for Each Layer

    Select each layer in the editor and look at the Adaptive Settings panel in the right sidebar:

    Screenshot 2026-06-01 at 4.33.14 PM.png

    Here's how we configured the layers for every layer in the template above:

    • Adaptive Position: Scale
    • Adaptive Size: Scale
    • Aspect Ratio: Free
    • Adaptive Anchor Gap: None

    This makes the objects in the template grow to fill the full width and adjust its position proportionally as the canvas changes, keeping the visual hierarchy intact across sizes.

    You can click “Help” to see the more information about the settings:

    image.png

    And click “Open Adaptive Preview” to see how your template renders at various dimensions:

    Screenshot 2026-06-01 at 4.58.01 PM.png

    Once you’re happy with how they look, save and exit the template editor.

    Step 3. Get Your Template ID and API Key

    To call the Bannerbear API, you'll need two things—your template ID and an API key.

    You can find the template ID in the top right corner of your template page:

    Screenshot 2026-06-02 at 9.56.21 AM.png

    For the API key, head to Developers → API Keys and create a new one there:

    Screenshot 2026-06-02 at 9.58.12 AM.png

    Copy both values. We’ll add both to our project's .env file later.

    Step 4. Set Up Your Node.js Project

    Create a new folder for your project and open a terminal in that directory.

    mkdir event-assets-generator
    cd event-assets-generator
    npm init -y
    

    Next, install dotenv so we can load environment variables from a .env file:

    npm install dotenv
    

    Create a .env file in the root of your project and add your API key and template UID:

    BANNERBEAR_API_KEY=your_bannerbear_api_key_here
    BANNERBEAR_TEMPLATE_UID=your_template_uid_here
    

    Then, create your index.js file and load the variables at the top:

    require('dotenv').config();
    const express = require('express');
    
    const API_KEY = process.env.BANNERBEAR_API_KEY;
    const TEMPLATE_UID = process.env.BANNERBEAR_TEMPLATE_UID;
    const BASE_URL = 'https://sync.api.bannerbear.com';
    

    Step 5. Write a Function to Generate an Image at a Custom Size

    The Bannerbear V5 API lets you override the template's width and height per request using modifications.template. This is how you tell the API to render your adaptive template at a different canvas size:

    async function generateEventImage(width, height) {
      const response = await fetch(`${BASE_URL}/v5/images`, {
        method: 'POST',
        headers: {
          'Authorization': `Bearer ${API_KEY}`,
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          template: TEMPLATE_UID,
          modifications: {
            template: {
              width: width,
              height: height,
            }
          },
        }),
      });
    
      const data = await response.json();
      return data;
    }
    

    The API will respond immediately with a 202 Accepted status and a pending image object. The status field will be pending until rendering is complete, at which point it changes to completed and the files object contains the URLs to your generated image.

    Step 6. Generate Images for Multiple Sizes

    Define the list of sizes you want to generate. As a starting point, these sizes cover the most common social media formats:

    const sizes = [
      { label: 'Instagram Post (Square)', width: 1080, height: 1080 },
      { label: 'Instagram Story / Reel', width: 1080, height: 1920 },
      { label: 'Facebook Post', width: 1200, height: 630 },
      { label: 'X Post', width: 1600, height: 900 },
      { label: 'Event Flyer (Portrait)', width: 800, height: 1100 },
    ];
    

    Lastly, add a self-invoking function to call the function we created earlier to generate images for each size in the array:

    (async () => {
      console.log('Generating event assets...\n');
    
      sizes.forEach(async size => {
          const image = await generateEventImage(size.width, size.height);
          console.log(`✓ ${size.label} (${size.width}×${size.height})`);
          console.log(` JPG: ${image.files.jpg}`);
        
      });
    
    })();
    

    Step 7. Run the Script

    To test it, run the command below in your terminal:

    node index.js
    

    You should see output like this:

    Screenshot 2026-06-02 at 10.18.11 AM.png

    Each URL points to a fully rendered image of your event template at the corresponding size. Open any of them in your browser to verify the layout looks right:

    Screenshot 2026-06-02 at 10.20.40 AM.png

    If a layer is out of position or the text is too small at a particular size, head back to the template editor and tweak the adaptive settings for that layer.

    Conclusion

    That’s it! With a single Bannerbear adaptive template and a few lines of JavaScript, you can generate a complete set of event marketing visuals in every format you need all from one API call. There's no manually duplicating templates or repositioning elements.

    If you'd like to be notified as soon as Bannerbear V5 launches, sign up for your free account. In the meantime, the current version of Bannerbear is fully capable and a great place to start!

    Here are a few tutorials to get you going:

    About the authorJosephine Loo
    Josephine is an automation enthusiast. She loves automating stuff and helping people to increase productivity with automation.

    Bannerbear V5 Full List of New Features

    Bannerbear V5 is here! We've spent the past several months rebuilding the template engine, editor, and API from the ground up. The result is a faster, more flexible Bannerbear with an even more powerful API. How to Use V5 To switch to the new V5...

    How to Automatically Create Pinterest Pin Images for Every Blog Post in Next.js with Bannerbear (v5 Adaptive Template)

    Learn how to automatically generate Pinterest Pin images for every Next.js blog post using Bannerbear's adaptive sizing feature. Using just one template, you can generate images in any size.

    How to Generate Youtube Thumbnails on Demand with Bannerbear and Airtable

    A single checkbox and a simple behind-the-scenes automation can transform your video marketing processes by putting Youtube thumbnails and other template-friendly assets at your fingertips. Here's how to set it all up.

    Automate & Scale
    Your Marketing

    Bannerbear helps you auto-generate social media visuals, banners and more with our API and nocode integrations

    How to Generate Event Marketing Graphics in Any Size from a Single Template Using Bannerbear (Node.js Tutorial)
    How to Generate Event Marketing Graphics in Any Size from a Single Template Using Bannerbear (Node.js Tutorial)