AI Facebook Ad Image Generation from Drive References
Loading workflow…
Workflow Description
A manually triggered workflow reads reference ad images and product images from two hardcoded Google Drive folders, analyzes them with GPT-4o to extract ad style principles and product emotions, merges both analyses, then an AI agent with a structured output parser generates ten image prompts. Each prompt loops through a 15-second wait, calls the OpenAI image generation API (gpt-image-1, 1024x1024), converts the base64 result to a PNG file, and uploads it to a target Drive folder.
How it works
- 1.Lists and downloads files from the inspiration folder and product folder in Google Drive.
- 2.GPT-4o analyzes inspiration images for reusable static ad style principles and product images for core emotions and product identity.
- 3.A third OpenAI node combines both analyses into a single prompt making the product the hero.
- 4.An AI agent with a GPT-4 chat model and structured output parser produces ten JSON-formatted image prompts that Split Out separates.
- 5.Loop Over Items routes each prompt through a 15-second Wait node then a POST to api.openai.com/v1/images/generations.
- 6.Convert to File turns data[0].b64_json into image.png, Google Drive4 uploads it, and the loop returns for the next item.
Use cases
- Batch-generating 1:1 static Facebook/Instagram ad creatives featuring a specific product.
- Turning a swipe file of high-performing ads into reusable style templates applied to new products.
Requirements
- Google Drive OAuth2 credentials with read access to both source folders and write access to the output folder.
- A single OpenAiApi credential covering GPT-4o, GPT-4, and gpt-image-1 with sufficient credit for ten images per run.
- Replacing the three hardcoded Drive folder IDs with your own folder identifiers.
Setup and testing in n8n
- Run manually and confirm both Drive listings and both GPT-4o analyses return content.
- Verify the agent emits valid JSON with ten unique prompts before Split Out.
- Check the target Drive folder for the ten generated PNG files and inspect the OpenAI API usage for errors.
Service Value
Ideal as a smart automation service combining integrations and AI to produce ready-to-use results.
Apps Used
Details
How to Use
- 1.Click "Download Template"
- 2.Open your n8n dashboard
- 3.Go to Workflows > Import from File
- 4.Select downloaded file and configure credentials
Nodes Used (17)
When clicking ‘Test workflow’
Manual Trigger
Google Drive
Google Drive
Google Drive1
Google Drive
OpenAI
OpenAI
Google Drive2
Google Drive
Google Drive3
Google Drive
OpenAI1
OpenAI
OpenAI Chat Model
OpenAI
AI prompt agent
Agent
Structured Output Parser
Output Parser Structured
Split Out
Split Out
HTTP Request1
HTTP Request
Loop Over Items1
Split In Batches
Wait
Wait
Convert to File
Convert To File
OpenAI2
OpenAI
Google Drive4
Google Drive
Source and license
Sticky Note
Fresh workflows, straight to your inbox
Get newly published DROPIDEA workflows, a clear overview of what they do, and a link to explore them.
- New workflows
- Clear overviews
- Setup guides