material-transfer
Transfer a material from an image to a subject
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)
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
https://api.segmind.com/v1/material-transfer
Parameters
material_image
requiredstring (uri)
Material to transfer to the input image
"https://segmind-sd-models.s3.amazonaws.com/display_images/ruby.png"
subject_image
requiredstring (uri)
Subject image to transfer the material to
"https://segmind-sd-models.s3.amazonaws.com/display_images/bird.png"
guidance_scale
optionalnumber
Guidance scale for the diffusion process
2
Range: 1 - 10material_strength
optionalstring
An enumeration.
"medium"
"medium"
"strong"
max_height
optionalinteger
Max height of the output image
1920
max_width
optionalinteger
Max width of the output image
1920
negative_prompt
optionalstring
What you do not want to see in the image
""
output_format
optionalstring
An enumeration.
"webp"
"webp"
"jpg"
"png"
output_quality
optionalinteger
Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.
80
Range: 0 - 100prompt
optionalstring
Use a prompt that describe the image when the material is applied
"marble sculpture"
return_intermediate_images
optionalboolean
Return intermediate images like mask, and annotated images. Useful for debugging.
false
seed
optionalinteger
Set a seed for reproducibility. Random by default.
null
steps
optionalinteger
Number of steps. 6 steps gives good results, but try increasing to 15 or 20 if you need more detail
6
Response Type
Returns: Image
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out