AI transformation reference
This page specifies the AI transformations, their GraphQL mutations and options, the records they produce, and how they interact with standard transformations.
Prerequisites
AI transformations require a valid ai-transform-token, and allow-ai-transforms must be enabled.
Both are set on the web component.
See DAT web component reference for these attributes.
Remove background
Removes the background from an image, leaving the subject on a transparent background.
-
Always available; no feature flag.
-
Executes immediately.
-
Returns a single result URL.
mutation RemoveBackground($url: String!) {
ImageTransform_removeBackground(source: { url: $url }) {
result
}
}
Replace background
Replaces the image background using generative AI, with an optional text prompt.
-
Controlled by the
replaceBackgroundfeature flag. -
Returns multiple variations.
-
Supports a text prompt to guide generation.
mutation GenerativeFill(
$url: String!
$options: ImageTransform_GenerativeFillOptionsInput
) {
ImageTransform_generativeFill(source: { url: $url }, options: $options) {
results
}
}
| Field | Type | Description |
|---|---|---|
|
string |
Text description to guide background generation. |
|
number |
Number of alternative results to generate (default: 3). |
Generative expand
Expands the canvas of an image beyond its original boundaries using AI-generated content.
-
Always available; no feature flag.
-
Not available when either dimension is 4000 pixels or greater (maximum: 3999).
-
Returns multiple variations.
-
Supports a text prompt and configurable placement and insets.
mutation GenerativeExpand(
$url: String!
$options: ImageTransform_BackgroundExpansionOptionsInput
) {
ImageTransform_expandBackground(source: { url: $url }, options: $options) {
results
}
}
| Field | Type or values | Description |
|---|---|---|
|
|
Horizontal alignment of the original image within the expanded canvas. |
|
|
Vertical alignment of the original image within the expanded canvas. |
|
number |
Expansion in pixels above the image. |
|
number |
Expansion in pixels to the right. |
|
number |
Expansion in pixels below the image. |
|
number |
Expansion in pixels to the left. |
|
number |
Target canvas width (maximum: 3999). |
|
number |
Target canvas height (maximum: 3999). |
|
string |
Optional text to guide generation. |
|
number |
Number of alternative results (default: 3). |
AI transform records
AI transformations are tracked independently from standard transformations.
-
Each AI operation adds its result URL to the base URL history.
-
An AI transform record is stored with the operation type and any optional prompt.
-
The reset action undoes the last AI operation by reverting to the previous URL in the history.
-
AI transform records are included in the
dat-selected-assetevent payload.
| Name | Operation |
|---|---|
|
Remove background |
|
Replace background |
|
Generative expand |
Interaction with standard transformations
AI transformations and standard transformations operate on different layers.
-
Standard transformations (crop, resize, adjustments) are URL-encoded and appended to the base URL.
-
AI transformations modify the base URL itself, because the AI service returns a new image URL.
-
After an AI transformation, standard transformations are re-applied on top of the new base URL.
-
Both histories are preserved and included in event payloads.
See Standard transformation URL reference for the standard transformation URL scheme.