What This Automation Does
This n8n workflow edits images automatically by using text instructions from chat messages and OpenAI’s ImageGen API.
It removes slow manual work, saving hours by sending images and text prompts to the API, getting edited images back, and making them ready for download or upload without extra steps.
You can use the edited images right away in emails, cloud storage, or social media posts.
Who Should Use This Workflow
This workflow suits people who need fast image editing from text instructions and want to stop spending many hours editing manually.
Freelancers, small business owners, and creative workers can benefit by cutting tedious back-and-forth steps.
No deep technical skills are needed if you follow the guide and have basic n8n knowledge.
Tools and Services Used
- n8n: Automation platform to run the workflow.
- OpenAI API: Specifically ImageGen v1 for editing images via API calls.
- Chat Trigger node: Captures chat messages with text and image attachments.
- HTTP Request node: Sends the image and prompt to OpenAI API.
- Convert to File node: Changes base64 image data to binary file format.
This setup can connect with email or cloud file service nodes after conversion for more automation.
Inputs, Processing Steps, and Output
Inputs
- User chat messages that have text prompts and an image file uploaded.
Processing Steps
- Chat Trigger node listens and captures the prompt and image file.
- HTTP Request node sends prompt and image binary to OpenAI images/edits endpoint.
- OpenAI returns edited image as base64 string in JSON response.
- Convert to File node turns base64 string into a binary image file.
Output
- A ready-to-use binary image file that can be downloaded, uploaded, emailed, or shared automatically.
Beginner Step-by-Step: How to Use This Workflow in n8n
Import the Workflow
- Inside the n8n editor, use the “Download” button on this page to get the workflow file.
- Click “Import from File” in n8n and upload the downloaded workflow file.
Configure Credentials and Settings
- Add your OpenAI API key in the provided credential node named “API KEY” exactly as given in your OpenAI account.
- Check the When chat message received node and ensure file uploads are enabled and MIME types set to accept images.
- Update any IDs, emails, channels, or storage folder settings if connected to downstream nodes.
- Verify that the HTTP Request node dynamically receives prompt text from chat input and image binary from the correct field (
data0).
Test and Activate
- Run a test by sending a chat message with a text prompt and an image to confirm the workflow processes and returns an edited image file.
- If everything works, turn the workflow on to activate it for production use.
Note: If you want to use self-host n8n, import and configure the workflow the same way.
Customizations
- Change image size by editing the
sizeparameter in the HTTP Request node (e.g., 512×512) for faster results. - Add more images per prompt by increasing the
nparameter. - Include cloud storage nodes like Supabase or AWS S3 after Convert to File to save images automatically.
- Connect an email node to send edited images directly to clients once converted.
Troubleshooting
Problem: “401 Unauthorized” or API Key Rejected
The API key could be wrong or expired.
Check your OpenAI API key in the “API KEY” node and update it if needed.
Problem: Image Upload Fails at Chat Trigger Node
File uploads may not be turned on or allowed MIME types are missing.
Enable file uploads and set MIME types to * in the When chat message received node.
Pre-Production Checklist
- Test chat messages uploading different image files.
- Confirm OpenAI API key works and includes image edit access.
- Make sure prompt text and images send correctly to the HTTP Request node.
- Check the Convert to File node produces a usable image binary output.
- Do a full run: chat message to final edited image file.
Deployment Guide
Turn on the workflow in n8n and use the webhook URL from the When chat message received node.
Watch executions in n8n to see chat input and API results live.
Add alerts like emails inside n8n workflows to catch any errors early.
The workflow only needs n8n and OpenAI API, no extra tools.
Summary
✓ Saves user 2-3 hours by automating text-driven image editing.
✓ Automatically converts base64 API images to download-ready files.
✓ Works inside n8n with OpenAI ImageGen and chat input nodes.
→ Outputs edited images ready for cloud upload, email, or sharing.
