Ideogram 3 Replace Background Serverless API
Effortlessly replace backgrounds in images, enhancing visual storytelling and creativity with precision and speed.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/ideogram-3-replace-background"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "Add a forest in the background",
12 "image": "https://segmind-resources.s3.amazonaws.com/output/085c3d6b-0ecd-4f79-9b41-823c451070f5-ideo-3.png",
13 "rendering_speed": "DEFAULT",
14 "magic_prompt": "AUTO",
15 "style_codes": [],
16 "style_reference_images": []
17}
18
19response = requests.post(url, headers=headers, json=data)
20
21if response.status_code == 200:
22 result = response.json()
23 print(json.dumps(result, indent=2))
24else:
25 print(f"Error: {response.status_code}")
26 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/ideogram-3-replace-background"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "Add a forest in the background",
12 "image": "https://segmind-resources.s3.amazonaws.com/output/085c3d6b-0ecd-4f79-9b41-823c451070f5-ideo-3.png",
13 "rendering_speed": "DEFAULT",
14 "magic_prompt": "AUTO",
15 "style_codes": [],
16 "style_reference_images": []
17}
18
19response = requests.post(url, headers=headers, json=data)
20
21if response.status_code == 200:
22 result = response.json()
23 print(json.dumps(result, indent=2))
24else:
25 print(f"Error: {response.status_code}")
26 print(response.text)API Endpoint
https://api.segmind.com/v1/ideogram-3-replace-backgroundParameters
imagerequiredstring (uri)Upload the base image for editing. Ensure high resolution for best results.
promptrequiredstringProvides a description for the image creation. Use specific prompts for detailed or themed images.
"Add a forest in the background"color_paletteoptionalany | anyA color palette for generation
Preset Color PaletteoptionalanynamerequiredstringCustom Color Paletteoptionalanymembersrequiredobject[]magic_promptoptionalstringEnhance prompts automatically. Choose 'AUTO' for balanced enhancements.
"AUTO""AUTO""ON""OFF"rendering_speedoptionalstringAdjust speed versus detail. Use 'QUALITY' for highly detailed images.
"DEFAULT""TURBO""DEFAULT""QUALITY"seedoptionalintegerSets a reproducible seed for consistency. Keep null for unique results each time.
nullRange: 100 - 999999style_codesoptionalstring[]Select specific styles to influence the output. Combine for unique aesthetics.
style_reference_imagesoptionalstring[]Use reference images for style influence. Best for specific visual styles.
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