๐ฌ Generate images with realistic inpainting using Simbrams Ri AI
โก 985 views ยท ๐ฌ Content Creation & Video
Description
Generate Images with Realistic Inpainting using Simbrams Ri AI
This n8n workflow integrates with Replicateโs simbrams/ri model to generate images. It takes an input image and mask, applies transformations based on your parameters, and returns the final generated output automatically.
๐ Section 1: Trigger & Authentication
โก On Clicking โExecuteโ (Manual Trigger)
- Purpose: Starts the workflow manually.
- Benefit: Useful for testing and running on demand.
๐ Set API Key (Set Node)
- Purpose: Stores your Replicate API key inside the workflow.
- Benefit: Keeps credentials secure and ensures other nodes can reuse them.
๐ Section 2: Sending the Image Generation Request
๐ผ๏ธ Create Prediction (HTTP Request Node)
-
Purpose: Sends a POST request to Replicateโs API to start generating an image.
-
Input Parameters:
- image: Input image URL
- mask: Mask image URL
- seed: Randomness control (for reproducibility)
- steps: Number of refinement steps
- strength: Intensity of modification (0โ1)
- blur_mask: Whether to blur the mask edges
- merge_m_s: Whether to merge mask with source
-
Benefit: Gives full control over how the model modifies your image.
๐ Extract Prediction ID (Code Node)
- Purpose: Extracts the Prediction ID, status, and URL from Replicateโs response.
- Benefit: Required to check the status of the generation later.
๐ Section 3: Polling & Waiting
โณ Wait (Wait Node)
- Purpose: Pauses the workflow for 2 seconds before rechecking.
- Benefit: Prevents hitting Replicateโs API too quickly.
๐ Check Prediction Status (HTTP Request Node)
- Purpose: Checks whether the prediction is complete using the stored Prediction ID.
- Benefit: Automates monitoring of job progress.
โ Check If Complete (If Node)
-
Purpose: Decides if the prediction has finished.
-
Paths:
- True โ Sends result to processing.
- False โ Loops back to Wait and keeps checking.
-
Benefit: Ensures the workflow only ends when a valid image is ready.
๐ Section 4: Processing the Result
๐ฆ Process Result (Code Node)
-
Purpose: Cleans up the completed API response and extracts:
- Status
- Output (final generated image)
- Metrics
- Created & completed timestamps
- Model name (
simbrams/ri) - Final image URL
-
Benefit: Delivers a structured and ready-to-use result for display, storage, or further automation.
๐ Workflow Overview Table
| Section | Node Name | Purpose |
|---|---|---|
| 1. Trigger & Auth | On Clicking โExecuteโ | Starts the workflow manually |
| Set API Key | Stores API credentials | |
| 2. AI Request | Create Prediction | Sends image generation request |
| Extract Prediction ID | Extracts ID + status for tracking | |
| 3. Polling | Wait | Adds delay between checks |
| Check Prediction Status | Monitors job progress | |
| Check If Complete | Routes based on job completion | |
| 4. Result | Process Result | Extracts and cleans the final output |
๐ฏ Key Benefits
- ๐ Secure authentication with API key management.
- ๐ผ๏ธ Custom image generation with parameters like mask, strength, and steps.
- ๐ Automatic polling ensures results are fetched only when ready.
- ๐ฆ Clean structured output with final image URL for easy use.
๐ Nodes Used
HTTP Request
๐ฅ Import
Download workflow.json and import into n8n:
Workflow menu โ Import from File