Generate Image icon

Generate Image

Generate Text Based Images

Generate Image

AI-generated

Overview

This node generates a text-based image with customizable dimensions, colors, font, and format. It is useful for creating simple images on the fly that contain text, such as placeholders, banners, or labels without needing external graphic design tools.

Typical use cases include:

  • Generating placeholder images for web development.
  • Creating dynamic text images for social media posts or marketing materials.
  • Producing custom badges or labels programmatically.

For example, you can generate a 300x200 pixel image with a blue background, white text in the "Poppins" font, sized 20px, output as a PNG file containing the word "Hello".

Properties

Name Meaning
Image Width Width of the generated image in pixels (number).
Image Height Height of the generated image in pixels (number).
Background color Background color of the image, specified as a hex color code (e.g., #000000 for black).
Text Color Color of the text, specified as a hex color code (e.g., #ffffff for white).
Font Family Font used for the text. Options include: Pacifico, Poppins, Quicksand, Bitter, Cairo, Comfortaa, Cookie, Dosis, Gotham, Lobster, Marhey, Qwigley, Satisfy, Ubuntu. Default is Pacifico.
Font Size Size of the font in pixels (number).
Text The text string to be rendered onto the image.
Image Format Output image format. Options are PNG, JPG, WEBP. Default is PNG.

Output

The node outputs one item containing:

  • json: An empty JSON object {}.
  • binary.data: The generated image file in binary form, named according to the chosen image format (e.g., image.png, image.jpg, or image.webp). This binary data can be used downstream for saving to disk, uploading, or further processing.

Dependencies

  • The node makes an HTTP GET request to an external service endpoint /image/{width}x{height}/{backgroundColor}/{textColor} with query parameters specifying font family, font size, text, and image type.
  • No API keys or authentication credentials are required.
  • The node relies on an internal helper method to prepare the binary data from the response.

Troubleshooting

  • Common issues:

    • Invalid color codes (not starting with # or incorrect length) may cause unexpected image colors or errors.
    • Unsupported font family values might result in default font usage or failure.
    • Very large image dimensions could lead to performance issues or timeouts.
    • Network connectivity problems will prevent image generation.
  • Error messages:

    • HTTP request failures (e.g., 404 or 500 errors) indicate issues with the external image generation service.
    • If the binary data preparation fails, it may be due to invalid response content or unsupported image format.

To resolve these:

  • Ensure all input properties are valid and correctly formatted.
  • Check network access to the external service.
  • Use supported fonts and reasonable image sizes.

Links and References

  • No direct external documentation links are provided in the source code.
  • For color codes and font options, refer to standard CSS color and font references.

Discussion