Reference · Tools

Grok Image Edit

Edit images using xAI Grok.

Action (binary) AI v1 Binary data

Grok Image Edit modifies an existing image from a text instruction — changing a background, adding an object, restyling a shot — and returns up to four edited versions. The results are written to the binary store ready for the next node. A typical build is standardising user-uploaded product photos onto a clean background before they reach a catalogue.

Node type
Action (binary)
Parameters
7
Outputs
Output, Error
Credentials
xAI

Grok Image Edit

Edit images using xAI Grok.

Overview

Grok Image Edit reads a source image from the input item’s binary data, sends it with a text prompt describing the desired edit, and returns the edited image(s) as binary data or as temporary URLs. Supports up to four output variations per request and a choice of response format.

Category: AI
Tool Name: grok_image_edit
Version: 1

Appearance: Icon: brain | Color: #000000

Node Type

Action (Binary) — handles file/binary data operations

Input / Output

DirectionPort(s)
InputInput
OutputOutput, Error

Credentials

This tool requires xAI credentials. See the Credentials Guide for setup instructions.

Parameters

ParameterTypeRequiredDefaultDescription
ModeloptionsNoPlatform defaultThe xAI Grok Imagine image model to use for editing (img2img).
Options: the Grok Imagine image models currently available — the dropdown tracks the model catalog, so it changes as xAI’s line-up changes.
PromptstringYesText description of the desired image edit. If empty, falls back to the input item’s “prompt” field. Supports expressions.
Input Binary Property NamestringNodataThe name of the binary property containing the source image to edit. Names are case-sensitive — see the upstream node’s Binary Data panel for the exact names to use.
Output Binary Property NamestringNodataThe name of the binary property where the edited image will be stored.
OptionscollectionNo{}Optional generation and output settings — add only the fields you want to override.
— Number of Images (n)numberNo1Number of edited image variations to generate. Range: 1-4.
— Response FormatoptionsNobinaryDataWhether to return the edited image as binary data or as a temporary URL.
Options: binaryData (return the edited image as binary data), imageUrl (return a temporary URL to the edited image)
Include InputbooleanNofalseWhether to include the original input item fields in the output alongside the edited image.
Max ConcurrencynumberNo5Maximum number of items to process concurrently.

Output Data

One output item per edited image — an input item asking for four variations produces four output items. The rest of the input JSON is carried over only when Include Input is on.

  • imageIndex — the position of this variation within the request, starting at 0.
  • edited — always true, a marker that this item came out of an edit.
  • model — the model used for the edit.
  • prompt — the edit prompt as resolved for this item, after expressions were evaluated.
  • imageUrl — a temporary URL for the edited image. Present only in imageUrl mode.

In binaryData mode the edited image is attached to the output item as binary data under the name given by Output Binary Property Name (data by default), merged alongside the binary the input item already carried. Leaving the output name equal to the input name replaces the source image in place; giving it a different name keeps both. In imageUrl mode no new binary is produced and the input item’s binary is forwarded unchanged.

Reference the result downstream by expression, e.g. {{ $json.imageUrl }}, or connect the output straight to a node that consumes binary data.

Usage Examples

  • Edit a photo to add a sunset background
  • Remove an object from an image using a text prompt
  • Apply a style change to an uploaded image
  • Generate multiple edit variations of a source image
  • Modify image content based on dynamic text instructions

Example Configuration

Edit the incoming image in place:

{
  "type": "grok_image_edit",
  "parameters": {
    "prompt": "Replace the background with a golden-hour beach scene",
    "inputBinaryPropertyName": "data",
    "outputBinaryPropertyName": "data"
  }
}

Produce four variations and keep the original image alongside them:

{
  "type": "grok_image_edit",
  "parameters": {
    "prompt": "{{ $json.editInstruction }}",
    "inputBinaryPropertyName": "data",
    "outputBinaryPropertyName": "edited",
    "includeInput": true,
    "maxConcurrency": 2,
    "options": {
      "n": 4,
      "responseFormat": "binaryData"
    }
  }
}

Return a temporary URL for handing to another HTTP service:

{
  "type": "grok_image_edit",
  "parameters": {
    "prompt": "Increase contrast and sharpen the subject",
    "inputBinaryPropertyName": "data",
    "options": {
      "responseFormat": "imageUrl"
    }
  }
}

Error Handling

ModeBehavior
stopHalts workflow on first error
continueSkips failed items, passes successful ones through
errorPortRoutes failed items to Error output port

Tips

Grok Image Edit sends a source image and a text prompt to the xAI image editing API to apply visual modifications using Grok vision models. Use it when a workflow requires AI-driven image transformation based on natural language instructions, such as changing backgrounds, adding objects, or altering styles. It outputs up to four edited images as binary data or URLs, stored in the binary store and referenced in the main output item.

Frequently asked questions

How many edited images come back?

Up to four per request, which lets you generate several interpretations of the same instruction and choose between them rather than re-running the node.

Where does the source image come from?

Binary data on the incoming item, so it chains directly after a download, an upload step or another image node without any manual encoding.

Do I get binary or a URL?

Either, depending on how the node is configured — results are stored in the binary store and referenced on the output item, or returned as direct image URLs when that suits the downstream step better.

What kinds of edit work best?

Instructions describing a visible change: replacing a background, adding or removing an object, or shifting style. Precise pixel-level control is not what this is for — for that, an image-processing CLI through Execute Command is more predictable.

Build with the Grok Image Edit node

Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need xAI credentials first.

Open BusyBot

Last updated . Spotted something wrong? Tell us.