# Create Image Edit — LetzAI

> Creates an image edit task that modifies an existing image using inpainting or outpainting in LetzAI. See the documentation

- Key: `letzai-create-image-edit`
- Type: Action (Write)
- Version: 0.0.2
- App: LetzAI (`letzai`) — https://pipedream.com/apps/letzai.md
- This page (HTML): https://pipedream.com/apps/letzai/actions/create-image-edit
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/letzai/actions/create-image-edit/create-image-edit.mjs

## Description

Creates an image edit task that modifies an existing image using inpainting or outpainting in LetzAI. [See the documentation](https://api.letz.ai/doc#/image-edit/image_edit_create)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `mode` | `string` | Yes | The Editing Mode. Can be 'in' for Inpainting (modify within image) or 'out' for Outpainting (extend image) |
| `originalImageCompletionId` | `string` | No | The ID of the original image completion used for editing |
| `imageUrl` | `string` | No | The URL to the image you want to edit |
| `prompt` | `string` | No | Text description of the desired modifications |
| `mask` | `string` | No | Base64 encoded image mask (required for inpainting) |
| `width` | `integer` | No | The width of the image |
| `height` | `integer` | No | The height of the image |
| `imageCompletionsCount` | `integer` | No | Number of variations to generate |
| `settings` | `object` | No | Required for Outpainting. Format: {'panControls': {'up': false, 'right': false, 'down': false, 'left': false}, 'zoomSize': 1.5} |
| `webhookUrl` | `string` | No | Optional URL to receive a POST notification when upscale is complete |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "letzai",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "letzai-create-image-edit",
  arguments: {
    mode: "Mode",
    originalImageCompletionId: "Original Image Completion ID",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "letzai-create-image-edit",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    letzai: { authProvisionId: "apn_xxxxxxx" },
    mode: "Mode",
    originalImageCompletionId: "Original Image Completion ID",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "letzai-create-image-edit",
    "configured_props": {
      "letzai": { "authProvisionId": "apn_xxxxxxx" },
      "mode": "Mode",
      "originalImageCompletionId": "Original Image Completion ID"
    }
  }'
```

---

- App: https://pipedream.com/apps/letzai.md · All apps: https://pipedream.com/apps
