# Transform Image — change.photos

> Transforms an image with various effects and optimizations. See the documentation

- Key: `change_photos-transform-image`
- Type: Action (Write)
- Version: 0.0.3
- App: change.photos (`change_photos`) — https://pipedream.com/apps/change-photos.md
- This page (HTML): https://pipedream.com/apps/change-photos/actions/transform-image
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/change_photos/actions/transform-image/transform-image.mjs

## Description

Transforms an image with various effects and optimizations. [See the documentation](https://www.change.photos/api-docs)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `imageUrl` | `string` | Yes | URL of the image to transform |
| `width` | `integer` | No | Desired width in pixels of the output image |
| `height` | `integer` | No | Desired height in pixels of the output image |
| `format` | `string` | No | Output image format. Default: jpeg |
| `quality` | `integer` | No | Output image quality. Must be between 1 and 100. Default: 80 |
| `fit` | `string` | No | How the image should fit within the dimensions. Default: contain |
| `flip` | `boolean` | No | Flip the image vertically |
| `flop` | `boolean` | No | Flip the image horizontally |
| `rotate` | `integer` | No | Rotation angle in degrees. Must be between -360 and 360. Default: 0 |
| `grayscale` | `boolean` | No | Convert image to grayscale |
| `blur` | `string` | No | Gaussian blur sigma value. Must be between 0.3 and 1000. |
| `sharpen` | `boolean` | No | Apply sharpening effect |
| `compress` | `boolean` | No | Apply additional compression |
| `tintRedComponent` | `string` | No | Red Component of the RGB tint to apply to the image. Must be between 0 and 255. |
| `tintGreenComponent` | `string` | No | Green Component of the RGB tint to apply to the image. Must be between 0 and 255. |
| `tintBlueComponent` | `string` | No | Blue Component of the RGB tint to apply to the image. Must be between 0 and 255. |

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

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: "change_photos-transform-image",
  arguments: {
    imageUrl: "Image URL",
    width: 10,
  },
})
```

**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: "change_photos-transform-image",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    change_photos: { authProvisionId: "apn_xxxxxxx" },
    imageUrl: "Image URL",
    width: 10,
  },
})

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": "change_photos-transform-image",
    "configured_props": {
      "change_photos": { "authProvisionId": "apn_xxxxxxx" },
      "imageUrl": "Image URL",
      "width": 10
    }
  }'
```

---

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