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 "steps": 6,
12 "prompt": "marble sculpture",
13 "max_width": 1920,
14 "max_height": 1920,
15 "output_format": "webp",
16 "subject_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/bird.png",
17 "guidance_scale": 2,
18 "material_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/ruby.png",
19 "output_quality": 80,
20 "material_strength": "medium",
21 "return_intermediate_images": false
22}
23
24response = requests.post(url, headers=headers, json=data)
25
26if response.status_code == 200:
27 result = response.json()
28 print(json.dumps(result, indent=2))
29else:
30 print(f"Error: {response.status_code}")
31 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 "steps": 6,
12 "prompt": "marble sculpture",
13 "max_width": 1920,
14 "max_height": 1920,
15 "output_format": "webp",
16 "subject_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/bird.png",
17 "guidance_scale": 2,
18 "material_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/ruby.png",
19 "output_quality": 80,
20 "material_strength": "medium",
21 "return_intermediate_images": false
22}
23
24response = requests.post(url, headers=headers, json=data)
25
26if response.status_code == 200:
27 result = response.json()
28 print(json.dumps(result, indent=2))
29else:
30 print(f"Error: {response.status_code}")
31 print(response.text)API Endpoint
https://api.segmind.com/v1/material-transferParameters
material_imagerequiredstring (uri)Material to transfer to the input image
"https://segmind-sd-models.s3.amazonaws.com/display_images/ruby.png"subject_imagerequiredstring (uri)Subject image to transfer the material to
"https://segmind-sd-models.s3.amazonaws.com/display_images/bird.png"guidance_scaleoptionalnumberGuidance scale for the diffusion process
2Range: 1 - 10material_strengthoptionalstringAn enumeration.
"medium""medium""strong"max_heightoptionalintegerMax height of the output image
1920max_widthoptionalintegerMax width of the output image
1920negative_promptoptionalstringWhat you do not want to see in the image
""output_formatoptionalstringAn enumeration.
"webp""webp""jpg""png"output_qualityoptionalintegerQuality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.
80Range: 0 - 100promptoptionalstringUse a prompt that describe the image when the material is applied
"marble sculpture"return_intermediate_imagesoptionalbooleanReturn intermediate images like mask, and annotated images. Useful for debugging.
falseseedoptionalintegerSet a seed for reproducibility. Random by default.
nullstepsoptionalintegerNumber of steps. 6 steps gives good results, but try increasing to 15 or 20 if you need more detail
6Response 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