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
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/sdxl-img2img"
# Request payload
data = {
"image": image_url_to_base64("https://segmind-sd-models.s3.amazonaws.com/display_images/sdxl-img2img-ip.jpg"), # Or use image_file_to_base64("IMAGE_PATH")
"samples": 1,
"prompt": "photorealistic, high-quality, ultra-detailed, image of (an origami bird with a layer that makes each folded polygonal section of the origami a different vivid c olor, an origami rainbow of color in a forest of origami plants and trees in the background), best quality, masterpiece, masterful composition, award, extremely detailed, incredibly high resolution, 32k, 16k, 8k, 4k, UHD, HDR, hyperrealistic, photo studio quality, amazing clarity, tack sharp, sharp focus, volumetric lighting, cinematic style",
"negative_prompt": "nude, disfigured, blurry",
"scheduler": "UniPC",
"base_model": "juggernaut",
"num_inference_steps": 30,
"guidance_scale": 6.5,
"strength": 0.65,
"seed": 98877465625,
"base64": False
}
headers = {'x-api-key': api_key}
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
Attributes
Input Image.
Number of samples to generate.
min : 1,
max : 4
Prompt to render
Prompts to exclude, eg. 'bad anatomy, bad hands, missing fingers'
Type of scheduler.
Allowed values:
base model for image generation
Allowed values:
Number of denoising steps.
min : 20,
max : 100
Scale for classifier-free guidance
min : 0.1,
max : 25
How much to transform the reference image
min : 0.1,
max : 1
Seed for image generation.
Base64 encoding of the output image.
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.
SDXL Img2Img
SDXL (Stable Diffusion XL) Img2Img is a powerful AI model well-suited for image-to-image editing (img2img). It allows you to take an existing image and modify it based on your text descriptions. It utilizes a two-stage process. The first stage generates a base image reflecting your edits. The second stage, powered by a separate refiner model, takes over and polishes the image, adding even finer details and enhancing overall quality. You provide a description of the desired transformation, and the model generates an output image based on both the input image and the text prompt.
Applications of SDXL Img2Img
SDXL Img2Img can be used for various creative applications. For instance, you can use it to modify or enhance existing images, create artistic variations, or even generate entirely new images guided by textual instructions.
-
Img2Img can generate artistic variations of an input image. You can experiment with different styles, filters, and effect.
-
Create novel image by providing a descriptive text prompt, you can create entirely new images.
-
Img2Img allows you to enhance or modify existing images.
Other Popular Models
sdxl-img2img
SDXL Img2Img is used for text-guided image-to-image translation. This model uses the weights from Stable Diffusion to generate new images from an input image using StableDiffusionImg2ImgPipeline from diffusers

fooocus
Fooocus enables high-quality image generation effortlessly, combining the best of Stable Diffusion and Midjourney.

sdxl-inpaint
This model is capable of generating photo-realistic images given any text input, with the extra capability of inpainting the pictures by using a mask

sd2.1-faceswapper
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
