Skip to content

Text to Image Node - Automate Image Generation

The Text to Image node under the AI node in the Tool Builder converts the text description (including keywords) you provide into an image URL within a single workflow. You can define what the image should include and exclude, and generate multiple enhanced variants of the same image in a batch before selecting the final image. This multimodal capability enables developers to efficiently handle and integrate text and image data types.

Exported Image Formats

The node generates the image output in the PNG format only.

Inputs

The key node inputs include:

  1. A detailed instruction set on what the image should contain, including the style, attributes, elements, location, background, lighting, look and feel, etc., in the Positive Prompt. For example, “Christmas greeting with Santa giving presents in the North Pole.”
  2. Instructions on what the image should exclude in the Negative Prompt. For example, add the words “Reindeers”, “black color”, or “Santa running” to avoid them in the image.
  3. The Aspect Ratio, including the width and height of the image. The maximum limit is 2048 x 2048, depending on the GPU specifications.
  4. The number of Steps to improve the image generation. Each step includes enhancements or improvements that align the output as closely as possible with the positive prompt instructions. This ensures that the generated image meets expectations by refining details, adjusting parameters, and optimizing quality while maintaining relevance to the intended prompt.

Important

Image generation depends on the number of steps in the process. While more steps add details, they also increase generation time and may cause the model to hallucinate, leading to deviations from the prompt instructions. To balance quality and efficiency, a maximum of 25-30 steps is recommended, minimizing unnecessary details (noise) and hallucinations in the final output.

  1. Batch Count to define the limit on the number of image versions/variants the node generates sequentially. A maximum of 5 images can be generated. For example, you can create the color and black-and-white versions of the same image sequentially in a batch and use each version for different purposes. For example, generate a Christmas greeting for employees and another for customers.

Processing Models

The Agent Platform uses the following variants of the Stable Diffusion model for text-to-image conversion:

  • stabilityai/stable-diffusion-xl-base-1.0
  • stabilityai/stable-diffusion-2-1
  • stable-diffusion-v1-5/stable-diffusion-v1-5

Output

The generated image output is available only in PNG format. Once created, the image is converted into a URL.

Use Case

A creative marketing team can use the system to generate images for emails, marketing content, and other promotional materials.

The integrated content moderation system ensures that the images meet quality and relevance standards, reducing the need for manual review. This eliminates the pain point of licensing images from official websites or relying on external image generators.

Instead of manually appending images later or integrating them into the tools flow through an API call, executing this node is more efficient.

Important Considerations

  • The node generates high-quality images based on the provided prompts and configurations.
  • The generated images are available forever and do not have an expiry period.
  • The model uses an input scanner in the node to detect and filter banned words or topics. If a banned topic is included in the input prompts, an error is generated and displayed in the debug window when the flow is executed.
  • Performance tracking is available under Settings > Model Analytics Dashboard > Opensource Models tab. Learn more.

The metrics include:

  • Number of images generated since the supported models are charged based on this count.
  • Input tokens since the Stable Diffusion models usually support a small number of tokens, and tracking the counts is necessary. Learn more.

Steps to Add and Configure the Node

To add and configure the node, follow the steps below:

Note

Before proceeding, you must add an external LLM to your account using either Easy Integration or Custom API integration.

  1. On the Tools tab, click the name of the tool to which you want to add the node. The Tool Flow page is displayed. click tool name

  2. Click Go to flow to edit the in-development version of the flow.
    access tool flow

  3. In the flow builder, click the + icon for Text to Image under AI in the Assets panel. Alternatively, drag the node from the panel onto the canvas. You can also click AI in the pop-up menu and click Text to Image. add node

  4. Click the added node to open its properties dialog box. The General Settings for the node are displayed.

  5. Enter or select the following General Settings:

    • Node Name: Enter an appropriate name for the node. For example, “Christmasgreeting.”
    • Select Model: Select the required variant of the Stable Diffusion model.
    • Positive Prompt: Enter the keywords for what needs to be generated in the image or what it should include. The model will generate along the lines of the details mentioned here and not consider the negative hints.
    • Negative Prompt: Enter the keywords for the elements the image should exclude.

    Important

    User prompts define specific questions or requests for the model to follow and generate results. You can use input variables you add in this step to add dynamic inputs to the prompt in the recommended syntax:{{context.variable_name}} before you run and test the flow. Learn more.

    • Aspect Ratio: Define the dimensions of the image in pixels for width and height.
    • Steps: Add the number of times the model will go back to the image and add more details/enhancements to get it as close to the prompt as possible. 25-30 steps are recommended for any image generation. Increasing the steps might add unwanted elements or model hallucinations and increase the time of generation.
    • Batch Count: The number of images to be generated sequentially.

    properties panel

Standard Error

When the Model is not selected, the prompt details are not provided, or both, the error message “Proper data needs to be provided in the LLM node” is displayed.

  1. Click the Connections icon and select the Go to Node for success and failure conditions.
  2. click connections
  • On Success > Go to Node: After the current node is successfully executed, go to a selected node in the flow to execute next, such as an AI node, Function node, Condition node, API node, or End node.
  • On Failure > Go to Node: If the execution of the current node fails, go to the End node to display any custom error message from the Text to Image node.
  • Node Output

    For the configured inputs, the following image is generated. output image
  1. Finally, Test the flow and fix any issues found.

Configure and Test the Flow for the Node

After adding and configuring the node as mentioned here, follow the steps below to test the flow.

Dynamic Prompt Inputs

Before you run the flow, provide clear instructions for the model to follow using the input variable(s) you add in the following step with the help of context variables. Context variables add dynamic values to the prompt instructions that the model will follow. The recommended syntax is: {{context.variable_name}}. For example, you can store the generated image URL in a variable named “Imaggenerated” and pass it on in the prompt when you mention "Generate an image based on the below description: {{context.steps.Start.Imaggenerated}}", as shown in the image below.

dynamic prompt input

Step 1: (Optional) Add Input Variable(s)

  1. Click the Input tab of the Start node, and click Add Input Variable to configure the input for the flow’s test run. Learn more.

add input variable

  1. Select Text for the Type field in the Enter input variable window to define a text input variable.
  2. Click Save. Learn more about accessing the node’s output.
  3. click add output variable

Add all the required input variables to run the flow in the Input section of the Start node.

Step 2: Add Output Variable(s)

  1. Click the Output tab for the Start node.
  2. Click Add Output Variable.

click add output variable

  1. Enter the value for Name (key) and select String for Type to generate the image URL.
  2. Click Save. Learn more about accessing the node’s output.
  3. save output variable

Step 3: Run the Flow

To run and test the flow, follow the steps below:

  1. Click the Run Flow button at the top-right corner of the flow builder. run the flow

  2. (Optional) Add the value for Input Variable if you have configured it to test the flow. Otherwise, go directly to the next step.

  3. Click Generate Output.

    generate output

The Debug window generates the flow log and results, as shown below. Learn more about running the tool flow.

debug window