ComfyUI Node

Imagen Product Recontext

Drop your product into any scene

By khanhlvg·Created about a year ago·Updated about a year ago· 4
Imagen Product Recontext
  • image1
  • image2
  • image3
  • images
project_id
locationus-central1
model
promptA product photo of a car on a race track.
productDescription
sampleCount1
seed2780628213
safetySetting
personGeneration

Imagen Product Recontext is the e-commerce node in the Vertex AI pack. You feed it a product photo - a sneaker, a car, a bottle - plus a text description of a new setting, and it returns the product placed in that scene, lit consistently, with the product itself preserved. This is the exact task that used to mean a studio shoot or hours of Photoshop, and it's one of those jobs where the paid cloud model genuinely outperforms local image gen, because the product must stay the same product.

What it is

It wraps Imagen's product recontextualization model (imagen-product-recontext-preview-06-30, still a preview). You get a dedicated node that takes up to three product images and a prompt describing the target context. The prompt is the scene, not the product: "a ceramic mug on a wooden desk next to morning light" - the model figures out which pixels are the product and which are the new environment.

How it works

The node converts your input image(s) to temp files and calls the recontext_image API with a RecontextImageSource (prompt plus product images) and a RecontextImageConfig carrying count, safety, person generation, and seed. It sets add_watermark=False (the invisible SynthID watermark is still there, as with all Imagen output). The returned images are decoded to RGBA tensors and stacked into one batched IMAGE.

Inputs that matter

  • image1 - required, the main product shot. Clean, well-lit product photos work dramatically better than messy crops.
  • image2, image3 - optional extra angles. Handing the model multiple views of the product helps it preserve details that a single photo misses.
  • prompt - the scene. Describe lighting and environment, not the product.
  • productDescription - optional but worth filling in: a plain-language description of what the product is and its materials ("a matte black espresso machine with a chrome portafilter"). This steadies the model when the product is ambiguous.
  • sampleCount (1–4), seed, safetySetting, personGeneration - standard Imagen controls.

Output is images, a standard IMAGE tensor, ready for preview, save, or a local polish pass.

Installing

Standard pack install - ComfyUI Manager searching "Vertex AI", or:

cd ComfyUI/custom_nodes
git clone https://github.com/khanhlvg/vertex-ai-comfyui-nodes.git
cd vertex-ai-comfyui-nodes
pip install -r requirements.txt

Then the pack-wide setup: gcloud auth application-default login, GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION (defaults us-central1) exported or typed in. Billing-enabled project with the Vertex AI API on. No local models.

Where people get burned

  • Reflection and logo preservation. Recontext models have their limits: glass and metallic products can lose their reflections, and small text/logo details may smear. Give the model a high-res input and the productDescription, and check the output before you trust it.
  • Preview-model caveats. The model name ends in preview, so expect occasional quality wobbles and the possibility that Google changes or sunsets it. If a workflow breaks after an update, the model string is the first thing to check.
  • Safety filters - if the API returns nothing, the prompt tripped a filter; relax the wording, not the safetySetting.

The one thing people consistently love about this node is that it collapses a whole product-photography workflow into a single run. Batch a dozen products through it with sampleCount up to 4 and you have a catalog's worth of scenes in an afternoon - then just pick the winners.

CategoryVertex AI

Inputs (12)

NameTypeDefaultDescription
project_idSTRING
locationSTRINGus-central1
modelCOMBO1 options: imagen-product-recontext-preview-06-30
promptSTRINGA product photo of a car on a race track.
image1IMAGE
image2optIMAGE
image3optIMAGE
productDescriptionoptSTRING
sampleCountoptINT11–4
seedoptINT27806282130–4294967295
safetySettingoptCOMBO4 options: BLOCK_ONLY_HIGH, BLOCK_MEDIUM_AND_ABOVE, BLOCK_LOW_AND_ABOVE, BLOCK_NONE
personGenerationoptCOMBO3 options: ALLOW_ALL, ALLOW_ADULT, DONT_ALLOW

Outputs (1)

NameTypeDescription
imagesIMAGE