material-transfer

Transfer a material from an image to a subject

~164.67s
~$0.253
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/material-transfer"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "seed": 1,
12    "steps": 6,
13    "prompt": "marble sculpture",
14    "max_width": 1920,
15    "max_height": 1920,
16    "output_format": "webp",
17    "subject_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/bird.png",
18    "guidance_scale": 2,
19    "material_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/ruby.png",
20    "output_quality": 80,
21    "negative_prompt": "sample text",
22    "material_strength": "medium",
23    "return_intermediate_images": false
24}
25
26response = requests.post(url, headers=headers, json=data)
27
28if response.status_code == 200:
29    result = response.json()
30    print(json.dumps(result, indent=2))
31else:
32    print(f"Error: {response.status_code}")
33    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/material-transfer

Parameters

material_imagerequired
string (uri)

Material to transfer to the input image

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/ruby.png"
subject_imagerequired
string (uri)

Subject image to transfer the material to

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/bird.png"
guidance_scaleoptional
number

Guidance scale for the diffusion process

Default: 2Range: 1 - 10
material_strengthoptional
string

An enumeration.

Default: "medium"
Allowed values :
"medium""strong"
max_heightoptional
integer

Max height of the output image

Default: 1920
max_widthoptional
integer

Max width of the output image

Default: 1920
negative_promptoptional
string

What you do not want to see in the image

Default: ""
output_formatoptional
string

An enumeration.

Default: "webp"
Allowed values :
"webp""jpg""png"
output_qualityoptional
integer

Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.

Default: 80Range: 0 - 100
promptoptional
string

Use a prompt that describe the image when the material is applied

Default: "marble sculpture"
return_intermediate_imagesoptional
boolean

Return intermediate images like mask, and annotated images. Useful for debugging.

Default: false
seedoptional
integer

Set a seed for reproducibility. Random by default.

Default: null
stepsoptional
integer

Number of steps. 6 steps gives good results, but try increasing to 15 or 20 if you need more detail

Default: 6

Response Type

Returns: Image

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out