# Upscale Image — DreamStudio (Stable Diffusion)

> Create a higher resolution version of an input image. See the documentation

- Key: `dreamstudio-upscale-image`
- Type: Action (Write)
- Version: 1.0.3
- App: DreamStudio (Stable Diffusion) (`dreamstudio`) — https://pipedream.com/apps/dreamstudio.md
- This page (HTML): https://pipedream.com/apps/dreamstudio/actions/upscale-image
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/dreamstudio/actions/upscale-image/upscale-image.mjs

## Description

Create a higher resolution version of an input image. [See the documentation](https://platform.stability.ai/docs/api-reference#tag/v1generation/operation/upscaleImage)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `organizationId` | `string` | Yes | The id of the organization. Options are loaded from the connected account. |
| `engineId` | `string` | Yes | The id of the engine. Options are loaded from the connected account. |
| `image` | `string` | Yes | Provide either a file URL or a path to a file in the /tmp directory (for example, /tmp/example.png) |
| `height` | `integer` | No | Height of the image in pixels. Must be in increments of 64 and pass the following validation: For 512 engines: 262,144 ≤ height * width ≤ 1,048,576. For 768 engines: 589,824 ≤ height * width ≤ 1,048,576. For SDXL Beta: can be as low as 128 and as high as 896 as long as width is not greater than 512. If width is greater than 512 then this can be at most 512. For SDXL v0.9: valid dimensions are 1024x1024, 1152x896, 1216x832, 1344x768, 1536x640, 640x1536, 768x1344, 832x1216, or 896x1152. For SDXL v1.0: valid dimensions are the same as SDXL v0.9 |
| `width` | `integer` | No | Width of the image in pixels. Must be in increments of 64 and pass the following validation: For 512 engines: 262,144 ≤ height * width ≤ 1,048,576. For 768 engines: 589,824 ≤ height * width ≤ 1,048,576. For SDXL Beta: can be as low as 128 and as high as 896 as long as height is not greater than 512. If height is greater than 512 then this can be at most 512. For SDXL v0.9: valid dimensions are 1024x1024, 1152x896, 1216x832, 1344x768, 1536x640, 640x1536, 768x1344, 832x1216, or 896x1152. For SDXL v1.0: valid dimensions are the same as SDXL v0.9 |
| `syncDir` | `dir` | No | SyncDir |

## 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": "dreamstudio",
      },
    },
  },
)

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: "dreamstudio-upscale-image",
  arguments: {
    organizationId: "Organization Id",
    engineId: "Engine 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: "dreamstudio-upscale-image",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    dreamstudio: { authProvisionId: "apn_xxxxxxx" },
    organizationId: "Organization Id",
    engineId: "Engine 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": "dreamstudio-upscale-image",
    "configured_props": {
      "dreamstudio": { "authProvisionId": "apn_xxxxxxx" },
      "organizationId": "Organization Id",
      "engineId": "Engine Id"
    }
  }'
```

---

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