Hi everyone,
I’m working on a workflow to process e-commerce product images, and I’m running into a common data merging problem. I would appreciate any advice on the best n8n pattern to solve this.
My Goal:
-
Start with a list of image URLs from a Google Sheet.
-
Download all the images.
-
For each image, use the Google Gemini (AI) node to analyze whether a watermark is placed over a person’s hand.
-
Split the workflow into two branches: one for images that pass the check (logo is on a hand) and one for images that fail.
-
Crucially, both branches need to have the full item, including the downloaded binary image file and its corresponding analysis data.
The Problem I’m Facing:
I’ve correctly set up parallel branches:
-
Branch A (Downloads): Code5 → Filter1 → Download_Images1 → … This branch successfully downloads the binary files.
-
Branch B (Analysis): The same Filter1 output → Analyze_Images → Filter (Code Node) → If. This branch correctly analyzes the images and the If node splits the JSON data.
The issue is that the Analyze_Images node does not pass through the binary data it receives. My final Merge node (which is supposed to combine the downloaded files from Branch A with the filtered JSON from Branch B) is failing because I can’t find a reliable way to match the items from the two branches.
I thought about adding a unique index to each item, splitting the branches, and then using a final Merge node to combine them based on this index. However, I’m struggling to get the wiring and the Merge node configuration just right.
My Question:
What is the correct n8n pattern to solve this? How can I reliably re-combine my stream of downloaded binary files with the corresponding JSON data after that data has been filtered by an If node?
Thank you in advance for your help