Imagen Edit (Vertex AI)
The mask-first editor that still knows where to stop
- image
- mask
- edited_images
Here's the thing about instruction-editing models like Qwen or Kontext: they're brilliant at "change the whole vibe," but they touch every pixel, and that drift compounds across edits. Imagen Edit is the other school - you give it a mask and it only touches what the mask covers. The unmasked pixels come back untouched, which is exactly what you want for surgical fixes. In a world that mostly abandoned masks, this node is a reminder that they still own that job.
What it is
An image/edit node that sends an image, a mask, and a prompt to Google's Imagen editing model. The edit_mode dropdown is the headline feature and covers the four real use cases:
EDIT_MODE_INPAINT_INSERTION- add something into the masked area (default).EDIT_MODE_INPAINT_REMOVAL- delete what's in the mask, fill it in.EDIT_MODE_OUTPAINT- extend the image beyond its edges.EDIT_MODE_BGSWAP- swap the background.
The mask is user-provided, which makes this the natural partner for the Gemini Segmentation node in this pack: describe what to mask, get a MASK, feed it straight into mask. Two nodes, one coherent edit pipeline.
How it works
Under the hood it calls Vertex AI's edit_image with your image and mask as reference images (mask uses MASK_MODE_USER_PROVIDED with a mask_dilation buffer). The model is hardcoded to imagen-3.0-capability-001 - there's no model input on this node, so don't go looking for one. You get back edited_images, one or more, decoded from the response.
The inputs that matter
The credential trio, same as the whole pack - project_id, location, service_account, and yes, service_account wants the JSON contents pasted in, not a path.
image+mask- your source and the edit region. The mask defines where; the prompt defines what.prompt- the edit instruction. Defaults to the uninspired "Edit this image"; say what you actually want.edit_mode- pick your operation (see above).mask_dilation(default 0.03) - expands the edit zone slightly past the mask edge. Bump it if you see a visible seam where the edit boundary meets untouched pixels.base_steps(10–100, default 50) andguidance_scale- the quality/speed dials.number_of_images- 1 to 4 candidates per run.negative_prompt- optional, and useful for "no text" type constraints.
Outputs
edited_images - an IMAGE output (stacked if you asked for multiple). Preview and compare against the source; for surgical edits, the comparison is the whole point.
Installing
cd ComfyUI/custom_nodes/
git clone https://github.com/Aryan185/ComfyUI-VertexAPI.git
cd ComfyUI-VertexAPI
pip install -r requirements.txt
Restart ComfyUI, or install ComfyUI-VertexAPI via ComfyUI Manager.
Where people get burned
The mask quality is everything. A sloppy mask gives you a sloppy edit, so make the mask carefully or let Gemini Segmentation make it for you. Expect the same Google safety filtering as the rest of the lineup - this won't do things your local inpaint shrugs at. And the "only touches the mask" guarantee is real but not absolute: at high base_steps or with a badly dilated mask, the edited region can bleed. If you see seams, dial mask_dilation up a touch; if you see the edit creep past its bounds, dial it down. Small numbers, big difference.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — | |
| prompt | STRING | Edit this image | — |
| project_id | STRING | — | |
| location | COMBO | us-central1 | 40 options: global, us-central1, us-east1, us-east4, us-east5, us-south1, +34 |
| service_account | STRING | — | |
| edit_mode | COMBO | EDIT_MODE_INPAINT_INSERTION | 4 options: EDIT_MODE_INPAINT_INSERTION, EDIT_MODE_INPAINT_REMOVAL, EDIT_MODE_OUTPAINT, EDIT_MODE_BGSWAP |
| number_of_images | INT | 11–4 | — |
| seed | INT | 691–2147483646 | — |
| base_steps | INT | 5010–100 | — |
| guidance_scale | FLOAT | 7.51–20 | — |
| mask_dilation | FLOAT | 0.030–1 | — |
| negative_promptopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| edited_images | IMAGE | — |