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


API

If you're looking for an API, you can choose from your desired programming language.

POST
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 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') 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
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


imageimage *

Input Image.


samplesint ( default: 1 ) Affects Pricing

Number of samples to generate.

min : 1,

max : 4


promptstr *

Prompt to render


negative_promptstr ( default: None )

Prompts to exclude, eg. 'bad anatomy, bad hands, missing fingers'


schedulerenum:str ( default: UniPC )

Type of scheduler.

Allowed values:


base_modelenum:str ( default: juggernaut )

base model for image generation

Allowed values:


num_inference_stepsint ( default: 30 ) Affects Pricing

Number of denoising steps.

min : 20,

max : 100


guidance_scalefloat ( default: 6.5 )

Scale for classifier-free guidance

min : 0.1,

max : 25


strengthfloat ( default: 0.65 )

How much to transform the reference image

min : 0.1,

max : 1


seedint ( default: -1 )

Seed for image generation.


base64boolean ( default: 1 )

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.