# Pixelcut Product Photo — API Reference Model ID: `model_pixelcut-product-photo` --- ## Authentication - **API_KEY** and **API_SECRET** are found in your [Scenario Project Settings](https://app.scenario.com/team&tab=api_keys) under API Keys. - Set them as environment variables `SCENARIO_SDK_API_KEY` and `SCENARIO_SDK_API_SECRET` — both SDKs pick them up by default. - For raw HTTP (cURL), use Basic Auth: `Authorization: Basic base64(":")`. ### Install the SDK - JavaScript / TypeScript: `npm install @scenario-labs/sdk` - Python: `pip install scenario-sdk` --- ## Generate **Endpoint:** `POST https://api.cloud.scenario.com/v1/generate/custom/model_pixelcut-product-photo` ### Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `image` | assetId | yes | - | The product photo to process. The subject is cut out and placed on your chosen background. | | `imageSize` | string | - | `square_hd` | Output canvas size. Square HD is 1024×1024. | | `backgroundMode` | string | - | `Color` | Solid color (default white), transparent cutout, or a custom background image. | | `backgroundColorRed` | number | - | `255` | Red channel for the solid background (0–255). Used when Background is Color. | | `backgroundColorGreen` | number | - | `255` | Green channel for the solid background (0–255). Used when Background is Color. | | `backgroundColorBlue` | number | - | `255` | Blue channel for the solid background (0–255). Used when Background is Color. | | `backgroundImage` | assetId | - | - | Image used as the background when Background is set to Image. | | `backgroundImageFit` | string | - | `Cover` | How the background image fills the canvas. Cover fills and crops; Contain fits with letterboxing; Stretch fills by distorting. | | `marginAll` | string | - | `20%` | Margin on all sides. Use % of the canvas (0–49%, e.g. 20%) or pixels (e.g. 40px). Per-side values below override this. | | `marginLeft` | string | - | - | Left-side override of All. Use % (0–49%) or px. | | `marginRight` | string | - | - | Right-side override of All. Use % (0–49%) or px. | | `marginTop` | string | - | - | Top-side override of All. Use % (0–49%) or px. | | `marginBottom` | string | - | - | Bottom-side override of All. Use % (0–49%) or px. | | `shadowType` | string | - | - | Optional shadow under the product. Leave unset for no shadow. Generative uses AI lighting; Drop is a classic offset shadow. | | `generativeShadowOpacity` | number | - | `0.2` | Opacity of the generative shadow (0–1). Used when Shadow is Generative. | | `dropShadowOpacity` | number | - | `0.25` | Opacity of the drop shadow (0–1). Used when Shadow is Drop. | | `dropShadowHorizontal` | number | - | `5` | Horizontal offset as a percent of canvas width. Positive moves right. Used when Shadow is Drop. | | `dropShadowVertical` | number | - | `0.8` | Vertical offset as a percent of canvas height. Positive moves down. Used when Shadow is Drop. | | `dropShadowBlur` | number | - | `1.2` | Blur radius as a percent of the smaller canvas side. Used when Shadow is Drop. | | `watermarkImage` | assetId | - | - | Optional logo or watermark overlaid on the output. | | `watermarkPosition` | string | - | `bottom_right` | Where to place the watermark on the canvas. | | `watermarkOpacity` | number | - | `1` | Watermark opacity (0–1). | | `watermarkScale` | number | - | `0.1` | Watermark width as a fraction of the canvas width. | ### Example Requests **cURL** ```bash curl -X POST "https://api.cloud.scenario.com/v1/generate/custom/model_pixelcut-product-photo" \ -H "Authorization: Basic $(echo -n ':' | base64)" \ -H "Content-Type: application/json" \ --data-binary @- <<'EOF' { "image": "", "imageSize": "square_hd", "backgroundMode": "Color", "backgroundColorRed": 255, "backgroundColorGreen": 255, "backgroundColorBlue": 255, "backgroundImageFit": "Cover", "marginAll": "20%", "generativeShadowOpacity": 0.2, "dropShadowOpacity": 0.25, "dropShadowHorizontal": 5, "dropShadowVertical": 0.8, "dropShadowBlur": 1.2, "watermarkPosition": "bottom_right", "watermarkOpacity": 1, "watermarkScale": 0.1 } EOF ``` **Python** ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), ) body = { "image": "", "imageSize": "square_hd", "backgroundMode": "Color", "backgroundColorRed": 255, "backgroundColorGreen": 255, "backgroundColorBlue": 255, "backgroundImageFit": "Cover", "marginAll": "20%", "generativeShadowOpacity": 0.2, "dropShadowOpacity": 0.25, "dropShadowHorizontal": 5, "dropShadowVertical": 0.8, "dropShadowBlur": 1.2, "watermarkPosition": "bottom_right", "watermarkOpacity": 1, "watermarkScale": 0.1 } response = client.generate.run_model( model_id="model_pixelcut-product-photo", body=body, ) print(response) ``` **JavaScript** ```javascript import Scenario from "@scenario-labs/sdk"; const client = new Scenario({ apiKey: process.env["SCENARIO_SDK_API_KEY"], apiSecret: process.env["SCENARIO_SDK_API_SECRET"], }); const body = { "image": "", "imageSize": "square_hd", "backgroundMode": "Color", "backgroundColorRed": 255, "backgroundColorGreen": 255, "backgroundColorBlue": 255, "backgroundImageFit": "Cover", "marginAll": "20%", "generativeShadowOpacity": 0.2, "dropShadowOpacity": 0.25, "dropShadowHorizontal": 5, "dropShadowVertical": 0.8, "dropShadowBlur": 1.2, "watermarkPosition": "bottom_right", "watermarkOpacity": 1, "watermarkScale": 0.1 }; const response = await client.generate.runModel("model_pixelcut-product-photo", { body }); console.info(response); ``` --- ## Retrieve Results After submitting a generation request, you receive a `jobId`. Poll the job until `job.status` is `"success"`. The generated asset IDs are in `job.metadata.assetIds`. **Endpoint:** `GET https://api.cloud.scenario.com/v1/jobs/{jobId}` ### Example Requests **cURL** ```bash curl -X GET "https://api.cloud.scenario.com/v1/jobs/" \ -H "Authorization: Basic $(echo -n ':' | base64)" ``` **Python** ```python job = client.jobs.retrieve(job_id="") print(job.status) print(job.metadata.asset_ids) ``` **JavaScript** ```javascript // Option 1 — wait on the response from runModel using the SDK helper const completed = await response.job.wait(); console.info(completed.status); console.info(completed.metadata?.assetIds); // Option 2 — retrieve a job by its ID const job = await client.jobs.retrieve(""); console.info(job.status); console.info(job.metadata?.assetIds); ``` **Example response:** ```json { "job": { "jobId": "job_abc123", "status": "success", "metadata": { "assetIds": [ "asset_abc123" ] } } } ``` > **Important:** Generated asset URLs are **temporary** and expire after a short period. Download and store any images you wish to keep before the URL expires. More info: [Content Delivery Network (CDN)](https://docs.scenario.com/get-started/documentation/content-delivery-network-cdn). --- *Generated by [Scenario](https://app.scenario.com)*