3x3 Grid For Product Ads
Upload your product and enter a brief prompt for each grid position in a 3x3 grid. Generates 9 distinct images. Select the images you like and upscale to 4k using your product as reference.
About
The '3x3 Grid For Product Ads' workflow is designed to streamline the process of generating visually appealing product images for advertising purposes. By leveraging a 3x3 grid layout, this workflow allows users to upload a product image and provide a distinct prompt for each grid position. This setup results in the generation of nine unique images, each tailored to highlight different aspects or features of the product.
The workflow utilizes the Nano Banana Pro model, known for its ability to maintain product integrity while adding creative variations, and the Google model for reliable image enhancement.
Technically, the workflow employs a variety of nodes to achieve its functionality. The GeminiImage2Node is crucial for image generation, while the LoadImage and SaveImage nodes manage the input and output processes. The workflow also includes custom nodes from ComfyUI-KJNodes and ComfyUI_essentials, which enhance the flexibility and customization options available to users. A unique feature of this workflow is its capability to upscale selected images to 4K resolution, ensuring high-quality outputs suitable for professional advertising.
This is particularly useful for businesses looking to create impactful visual content with minimal effort.
What you provide
- Reading the workflow
Runs in ComfyUI. This workflow can't run on this page. Open it in Comfy Cloud with everything loaded, or download it for your own ComfyUI.
Try in CloudInside the workflow
A read-only preview of the node graph. Open it in Comfy Cloud or download it to edit the nodes.
Loading the graph
Open full-size workflow preview- Author
- Rob
Requires custom nodes
- Reading the workflow
Use this workflow from code
Generated from the workflow graph and inputs when possible; stored examples are shown otherwise. Review credentials and endpoints before running code, which may incur charges.
What you need
- Runs on
- Comfy Cloud
- Key
- COMFY_API_KEY
- Your files
- Uploaded by the code from their urls
Needs a paid Cloud plan and credits.
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"10": {
"class_type": "GeminiImage2Node",
"inputs": {
"aspect_ratio": "auto",
"images": [
"11",
0
],
"model": "gemini-3-pro-image-preview",
"prompt": "Create an editorial photoreal 3×3 grid for a high end e commerce ad featuring only the following product: purple glass bottle with galaxy texture.\n\nBackground: minimalist studio. \nLighting: soft and diffused.\n\nGenerate as one 3×3 grid with no margin, gutter or borders.\n\nFollow the prompts for each grid image. If left blank use your creativity:\n\nPosition 1,1: Product hero shot\n\nPosition 1,2: Product pouring out liquid\n\nPosition 1,3: Extreme close up\n\nPosition 2,1: Bottle being opened with corkscrew bottle opener\n\nPosition 2,2: Bottle floating angled\n\nPosition 2,3: Liquid exploding\n\nPosition 3,1: \n\nPosition 3,2:\n\nPosition 3,3:",
"resolution": "4K",
"response_modalities": "IMAGE",
"seed": 54321,
"system_prompt": "You are an expert image-generation engine. You must ALWAYS produce an image.\nInterpret all user input—regardless of format, intent, or abstraction—as literal visual directives for image composition.\nIf a prompt is conversational or lacks specific visual details, you must creatively invent a concrete visual scenario that depicts the concept.\nPrioritize generating the visual representation above any text, formatting, or conversational requests."
},
"_meta": {
"title": "Nano Banana Pro (Google Gemini Image)"
}
},
"11": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Load Product Image"
}
},
"58": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 0
},
"_meta": {
"title": "Crop Inset Grid Images"
}
},
"59": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI-image_1",
"images": [
"56:29",
0
]
},
"_meta": {
"title": "Save Image 1"
}
},
"60": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI-image_2",
"images": [
"56:33",
0
]
},
"_meta": {
"title": "Save Image 2"
}
},
"61": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI-image_3",
"images": [
"56:39",
0
]
},
"_meta": {
"title": "Save Image 3"
}
},
"62": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI-image_4",
"images": [
"56:40",
0
]
},
"_meta": {
"title": "Save Image 4"
}
},
"63": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI-image_6",
"images": [
"56:45",
0
]
},
"_meta": {
"title": "Save Image 6"
}
},
"64": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI-image_5",
"images": [
"56:43",
0
]
},
"_meta": {
"title": "Save Image 5"
}
},
"65": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI-image_7",
"images": [
"56:46",
0
]
},
"_meta": {
"title": "Save Image 7"
}
},
"66": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI-image_8",
"images": [
"56:49",
0
]
},
"_meta": {
"title": "Save Image 8"
}
},
"67": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI-image_9",
"images": [
"56:51",
0
]
},
"_meta": {
"title": "Save Image 9"
}
},
"68": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI-image_stitched",
"images": [
"10",
0
]
},
"_meta": {
"title": "Save Stitched Image"
}
},
"79": {
"class_type": "GeminiImage2Node",
"inputs": {
"aspect_ratio": "auto",
"images": [
"93:87",
0
],
"model": "gemini-3-pro-image-preview",
"prompt": "Upscale image 1. Use the product from image 2 as a reference.",
"resolution": "4K",
"response_modalities": "IMAGE",
"seed": 54321,
"system_prompt": "You are an expert image-generation engine. You must ALWAYS produce an image.\nInterpret all user input—regardless of format, intent, or abstraction—as literal visual directives for image composition.\nIf a prompt is conversational or lacks specific visual details, you must creatively invent a concrete visual scenario that depicts the concept.\nPrioritize generating the visual representation above any text, formatting, or conversational requests."
},
"_meta": {
"title": "Nano Banana Pro (Google Gemini Image)"
}
},
"81": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI-image_upscaled",
"images": [
"79",
0
]
},
"_meta": {
"title": "Save Upscaled Image"
}
},
"91": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 1
},
"_meta": {
"title": "Select Image Number"
}
},
"56:18": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"10",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"56:29": {
"class_type": "ImageCrop",
"inputs": {
"height": [
"56:66",
0
],
"image": [
"10",
0
],
"width": [
"56:65",
0
],
"x": [
"56:67",
0
],
"y": [
"56:71",
0
]
},
"_meta": {
"title": "1"
}
},
"56:32": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"56:29",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"56:33": {
"class_type": "ImageCrop",
"inputs": {
"height": [
"56:66",
0
],
"image": [
"10",
0
],
"width": [
"56:65",
0
],
"x": [
"56:59",
0
],
"y": [
"56:71",
0
]
},
"_meta": {
"title": "2"
}
},
"56:34": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"56:33",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"56:38": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"56:39",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"56:39": {
"class_type": "ImageCrop",
"inputs": {
"height": [
"56:66",
0
],
"image": [
"10",
0
],
"width": [
"56:65",
0
],
"x": [
"56:60",
0
],
"y": [
"56:71",
0
]
},
"_meta": {
"title": "3"
}
},
"56:40": {
"class_type": "ImageCrop",
"inputs": {
"height": [
"56:66",
0
],
"image": [
"10",
0
],
"width": [
"56:65",
0
],
"x": [
"56:67",
0
],
"y": [
"56:63",
0
]
},
"_meta": {
"title": "4"
}
},
"56:41": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"56:40",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"56:42": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"56:43",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"56:43": {
"class_type": "ImageCrop",
"inputs": {
"height": [
"56:66",
0
],
"image": [
"10",
0
],
"width": [
"56:65",
0
],
"x": [
"56:59",
0
],
"y": [
"56:63",
0
]
},
"_meta": {
"title": "5"
}
},
"56:44": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"56:45",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"56:45": {
"class_type": "ImageCrop",
"inputs": {
"height": [
"56:66",
0
],
"image": [
"10",
0
],
"width": [
"56:65",
0
],
"x": [
"56:60",
0
],
"y": [
"56:63",
0
]
},
"_meta": {
"title": "6"
}
},
"56:46": {
"class_type": "ImageCrop",
"inputs": {
"height": [
"56:66",
0
],
"image": [
"10",
0
],
"width": [
"56:65",
0
],
"x": [
"56:67",
0
],
"y": [
"56:62",
0
]
},
"_meta": {
"title": "7"
}
},
"56:47": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"56:46",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"56:48": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"56:49",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"56:49": {
"class_type": "ImageCrop",
"inputs": {
"height": [
"56:66",
0
],
"image": [
"10",
0
],
"width": [
"56:65",
0
],
"x": [
"56:59",
0
],
"y": [
"56:62",
0
]
},
"_meta": {
"title": "8"
}
},
"56:50": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"56:51",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"56:51": {
"class_type": "ImageCrop",
"inputs": {
"height": [
"56:66",
0
],
"image": [
"10",
0
],
"width": [
"56:65",
0
],
"x": [
"56:60",
0
],
"y": [
"56:62",
0
]
},
"_meta": {
"title": "9"
}
},
"56:56": {
"class_type": "ImageBatchMulti",
"inputs": {
"image_1": [
"56:29",
0
],
"image_2": [
"56:33",
0
],
"image_3": [
"56:39",
0
],
"image_4": [
"56:40",
0
],
"image_5": [
"56:43",
0
],
"image_6": [
"56:45",
0
],
"image_7": [
"56:46",
0
],
"image_8": [
"56:49",
0
],
"image_9": [
"56:51",
0
],
"inputcount": 9
},
"_meta": {
"title": "Image Batch Multi"
}
},
"56:57": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"56:56",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"56:59": {
"class_type": "SimpleMath+",
"inputs": {
"a": [
"56:65",
0
],
"b": [
"56:64",
0
],
"value": "(a+b) + (b/2)"
},
"_meta": {
"title": "Col 2 - X val"
}
},
"56:60": {
"class_type": "SimpleMath+",
"inputs": {
"a": [
"56:65",
0
],
"b": [
"56:64",
0
],
"value": "(2*a) + (b*3)"
},
"_meta": {
"title": "Col 3 - X val"
}
},
"56:62": {
"class_type": "SimpleMath+",
"inputs": {
"a": [
"56:66",
0
],
"b": [
"56:64",
0
],
"value": "(2*a) + (3*b)"
},
"_meta": {
"title": "Row 3 - Y val"
}
},
"56:63": {
"class_type": "SimpleMath+",
"inputs": {
"a": [
"56:66",
0
],
"b": [
"56:64",
0
],
"value": "(a+b) + (b/2)"
},
"_meta": {
"title": "Row 2 - Y val"
}
},
"56:64": {
"class_type": "SimpleMath+",
"inputs": {
"a": [
"58",
0
],
"b": 0,
"value": "a"
},
"_meta": {
"title": "🔧 Simple Math"
}
},
"56:65": {
"class_type": "SimpleMath+",
"inputs": {
"a": [
"56:18",
0
],
"b": [
"56:64",
0
],
"value": "(a-3*b) / 3"
},
"_meta": {
"title": "WIDTH"
}
},
"56:66": {
"class_type": "SimpleMath+",
"inputs": {
"a": [
"56:18",
1
],
"b": [
"56:64",
0
],
"value": "(a-3*b) / 3"
},
"_meta": {
"title": "HEIGHT"
}
},
"56:67": {
"class_type": "SimpleMath+",
"inputs": {
"a": 0,
"b": [
"56:64",
0
],
"value": "b/2"
},
"_meta": {
"title": "Col 1 - X val"
}
},
"56:71": {
"class_type": "SimpleMath+",
"inputs": {
"a": 0,
"b": [
"56:64",
0
],
"value": "(b/2)"
},
"_meta": {
"title": "Row 1 - Y val"
}
},
"93:78": {
"class_type": "ImageFromBatch",
"inputs": {
"batch_index": [
"93:89",
0
],
"image": [
"56:56",
0
],
"length": 1
},
"_meta": {
"title": "Get Image from Batch"
}
},
"93:83": {
"class_type": "ResizeAndPadImage",
"inputs": {
"image": [
"11",
0
],
"interpolation": "area",
"padding_color": "white",
"target_height": [
"93:86",
1
],
"target_width": [
"93:86",
0
]
},
"_meta": {
"title": "Resize And Pad Image"
}
},
"93:86": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"93:78",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"93:87": {
"class_type": "ImageBatch",
"inputs": {
"image1": [
"93:78",
0
],
"image2": [
"93:83",
0
]
},
"_meta": {
"title": "Batch Images (DEPRECATED)"
}
},
"93:89": {
"class_type": "SimpleMath+",
"inputs": {
"a": [
"91",
0
],
"b": 0,
"value": "a - 1"
},
"_meta": {
"title": "Image # as index"
}
}
})
# Replace each example.com URL with a public URL of your file.
workflow.set_input("11", "image", client.assets.from_url("https://example.com/replace-with-a-url/image"))
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)Questions & answers
If borders appear between grid images, you can adjust the cropping settings in the Nano Banana Pro model to eliminate them.
While designed for products, the workflow can be adapted for other subjects by adjusting the prompts and input images.
You can install the custom nodes by following the instructions provided in the ComfyUI documentation.
Yes, you can enter a unique prompt for each grid position to tailor the generated images to your specific needs.