POST
javascript
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 const axios = require('axios'); const fs = require('fs'); const path = require('path'); async function toB64(imgPath) { const data = fs.readFileSync(path.resolve(imgPath)); return Buffer.from(data).toString('base64'); } const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/sdxl-img2img"; const data = { "image": toB64('https://segmind-sd-models.s3.amazonaws.com/display_images/sdxl-img2img-ip.jpg'), "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 }; (async function() { try { const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } }); console.log(response.data); } catch (error) { console.error('Error:', error.response.data); } })();
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.