demobook

n8n: Advanced image generation via HTTP Request

n8nTry it →Watch full video →Leon van Zyl ·

Demo summary

The demo walks through configuring an HTTP Request node in n8n to send a JSON payload to the Google API, allowing for custom aspect ratios and resolutions (1k, 2k, 4k).

Step-by-step

  1. Add an HTTP Request node and change the method to POST.
  2. Enter the Google API URL into the URL field.
  3. Set Authentication to Generic Credential Type and select Header Auth.
  4. Create a new credential with the name 'x-goog-api-key' and paste your API key into the value field.
  5. Enable Send Body, set Content Type to JSON, and select Using JSON for the body specification.
  6. Paste the JSON payload into the body field, ensuring the prompt is mapped from the previous form node.
  7. Add a 'Convert to File' node and select 'Base64 to File'.
  8. Map the data property from the HTTP Request output into the Base64 string field and execute.

Options

  • Set image size to 1k, 2k, or 4k
  • Adjust the aspect ratio within the generation config object

Watch out for

  • You must enable specific modalities within the generation config object for the request to work.
  • The HTTP Request node initially returns a raw base64 string rather than a viewable image file.

Tips

  • Rename the HTTP Request node to 'Generate Image' to keep the workflow organized.
  • If you don't want to type the JSON payload manually, copy it from the provided workflow description.

Highlights

Now there's really not much to this.

All demos from “Build ANYTHING with Nano Banana Pro and n8n

  1. 6:031:22Basic image generation with n8n Gemini nodeThe video shows how to use the standard Google Gemini node in n8n to generate an image by manually entering the model ID for Nano Banana Pro.n8nText to Image
  2. 7:572:28Advanced image generation via HTTP RequestCurrentThe demo walks through configuring an HTTP Request node in n8n to send a JSON payload to the Google API, allowing for custom aspect ratios and resolutions (1k, 2k, 4k).n8nAI Image Generator
  3. 10:273:02Edit images using n8n and Nano Banana ProThe creator demonstrates how to convert an uploaded image to base64 and use it in an n8n workflow to perform image-to-image editing with a text prompt.n8nImage to Image
  4. 13:292:55Combine multiple images into one generationThe video shows how to pass multiple base64 encoded images into a single API call to blend elements, such as placing a specific hat from one image onto a character from another.n8nAI Image Combiner
  5. Watch “Build ANYTHING with Nano Banana Pro and n8n” →

AI Image Generator

  1. 7:572:28Advanced image generation via HTTP RequestCurrentThe demo walks through configuring an HTTP Request node in n8n to send a JSON payload to the Google API, allowing for custom aspect ratios and resolutions (1k, 2k, 4k).Leon van Zyl
  2. 0:290:43End-to-end AI image generation workflow demoThe creator demonstrates the final automation by submitting a short description into an n8n form and showing how it triggers a sequence that generates a cinematic image and saves it to Google Drive.Bernard | AI Automation