n8nflow.net logo

Generate Images with Realistic Inpainting using Simbrams Ri AI

by Yaron BeenUpdated: Last update 23 days agoSource: n8n.io
Loading workflow viewer...

Getting Started

Generate Images with Realistic Inpainting using Simbrams Ri AI

This n8n workflow integrates with Replicate’ssimbrams/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

SectionNode NamePurpose
1. Trigger & AuthOn Clicking ‘Execute’Starts the workflow manually
Set API KeyStores API credentials
2. AI RequestCreate PredictionSends image generation request
Extract Prediction IDExtracts ID + status for tracking
3. PollingWaitAdds delay between checks
Check Prediction StatusMonitors job progress
Check If CompleteRoutes based on job completion
4. ResultProcess ResultExtracts 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.