API
If you're looking for an API, you can choose from your desired programming language.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import requests
import base64
# Use this function to convert an image file from the filesystem to base64
def image_file_to_base64(image_path):
with open(image_path, 'rb') as f:
image_data = f.read()
return base64.b64encode(image_data).decode('utf-8')
# Use this function to fetch an image from a URL and convert it to base64
def image_url_to_base64(image_url):
response = requests.get(image_url)
image_data = response.content
return base64.b64encode(image_data).decode('utf-8')
# Use this function to convert a list of image URLs to base64
def image_urls_to_base64(image_urls):
return [image_url_to_base64(url) for url in image_urls]
api_key = "YOUR_API_KEY"
url = "https://api.segmind.com/v1/ideogram-3-replace-background"
# Request payload
data = {
"prompt": "Add a forest in the background",
"color_palette": {
# Either provide a named palette
"name": "MELON", # required, mutually exclusive with "members"
# Or provide custom colors
"members": [ # required, mutually exclusive with "name"
{
"color_hex": "", # required if using "members"
"color_weight": 0 # optional
}
]
},
"image": image_url_to_base64("https://segmind-resources.s3.amazonaws.com/output/085c3d6b-0ecd-4f79-9b41-823c451070f5-ideo-3.png"), # Or use image_file_to_base64("IMAGE_PATH")
"rendering_speed": "DEFAULT",
"magic_prompt": "AUTO",
"style_codes": [],
"style_reference_images": []
}
headers = {'x-api-key': api_key}
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
Attributes
Provides a description for the image creation. Use specific prompts for detailed or themed images.
Upload the base image for editing. Ensure high resolution for best results.
Sets a reproducible seed for consistency. Keep null for unique results each time.
Adjust speed versus detail. Use 'QUALITY' for highly detailed images.
Allowed values:
Enhance prompts automatically. Choose 'AUTO' for balanced enhancements.
Allowed values:
Select specific styles to influence the output. Combine for unique aesthetics.
Use reference images for style influence. Best for specific visual styles.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Leveraging Ideogram 3's Replace Background API for Enhanced Image Editing
Ideogram 3.0 introduces a robust Replace Background API that significantly advances image editing capabilities for both developers and creators. This tool is essential for those who aim to achieve precision and creativity in their visual workflows.
Key Features and Benefits
Background Removal and Replacement: The API proficiently isolates the primary subject of an image, enabling seamless background removal without losing detail. Users can replace backgrounds by inputting specific prompts, generating scenes that align with desired themes such as "A peaceful beach sunset." This function is particularly beneficial for graphic designers who need to adapt visual assets for different campaigns and marketers who seek dynamic content creation without intensive manual effort.
Manual Editing Tools: Refined mask tools like brush and lasso let users perfect their subject selections, crucial for tackling intricate elements like hair or accessories. This allows creators to maintain high quality and attention to detail in each edit, ensuring a polished final product.
Scalability and Batch Processing: The API supports batch editing, crucial for large projects such as e-commerce catalogs or bulk marketing materials. Controlling rendering speed and output quality ensures adaptability to diverse project requirements, optimizing workflow efficiency.
Style Customization and Upscaling: With options to upscale images up to 4,500x5,400 pixels, the API guarantees that outputs are ready for print and digital displays. Style prompts further enhance creative flexibility, allowing users to tailor images to specific aesthetics or branding guidelines.
By integrating Ideogram 3's Replace Background API, users can streamline their image editing operations, fostering creativity while minimizing manual labor, ultimately enhancing productivity and visual storytelling capabilities.
Other Popular Models
fooocus
Fooocus enables high-quality image generation effortlessly, combining the best of Stable Diffusion and Midjourney.

faceswap-v2
Take a picture/gif and replace the face in it with a face of your choice. You only need one image of the desired face. No dataset, no training

sd1.5-majicmix
The most versatile photorealistic model that blends various models to achieve the amazing realistic images.

codeformer
CodeFormer is a robust face restoration algorithm for old photos or AI-generated faces.
