Skip to main content

Image Mixer Endpoint

Overview

This endpoint generates image by mixing multiple images.

Together with the image you can add your description of the desired result by passing prompt and negative prompt.

Request

--request POST 'https://stablediffusionapi.com/api/v5/img_mixer' \

Make a POST request to https://stablediffusionapi.com/api/v5/img_mixer endpoint and pass the required parameters as a request body to the endpoint.

Body Attributes

ParameterDescription
keyYour API Key used for request authorization
promptText prompt with description of the things you want in the image to be generated
negative_promptItems you don't want in the image
init_imagecomma separated image urls of images to mix
widthMax Height: Width: 1024x1024
heightMax Height: Width: 1024x1024
stepsNumber of denoising steps (minimum: 1; maximum: 50)
guidance_scaleScale for classifier-free guidance (minimum: 1; maximum: 20)
init_image_weightsweigth of the images being passed separated by comma
seedSeed is used to reproduce results, same seed will give you same image in return again. Pass null for a random number.
samplesNumber of images to be returned in response. The maximum value is 4.
guidance_scaleScale for classifier-free guidance (minimum: 1; maximum: 20)
webhookSet an URL to get a POST API call once the image generation is complete.
track_idThis ID is returned in the response to the webhook API call. This will be used to identify the webhook request.

Example

Body

Body
{
"key":"",
"seed":12345,
"init_image":"https://img.freepik.com/premium-photo/red-roses-rose-petals-white-backgroundvalentines-day-concept_167862-5720.jpg,https://huggingface.co/datasets/diffusers/test-arrays/resolve/main/stable_diffusion_inpaint/boy.png",
"prompt":"rose man",
"negative_prompt":"A polluted city",
"init_image_weights":"0.5,0.7",
"width":800,
"height":600,
"guidance_scale":10,
"steps":100,
"samples":1
}

Request

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"key": "",
"init_image":"https://img.freepik.com/premium-photo/red-roses-rose-petals-white-backgroundvalentines-day-concept_167862-5720.jpg,https://huggingface.co/datasets/diffusers/test-arrays/resolve/main/stable_diffusion_inpaint/boy.png",
"seed":"12345",
"prompt":"rose man",
"negative_prompt":"A polluted city",
"init_image_weights":"0.5,0.7",
"width":800,
"height":600,
"guidance_scale":10,
"steps":100,
"samples":1,
"webhook": null,
"track_id": null
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://stablediffusionapi.com/api/v5/img_mixer", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response

Example Response


{
"status": "success",
"generationTime": 19.260561227798462,
"id": 349,
"output": [
"https://cdn2.stablediffusionapi.com/generations/8aa6cb76-0c62-4ebc-a29a-3a3e3727bc88-0.png"
],
"meta": {
"H": 600,
"W": 800,
"file_prefix": "8aa6cb76-0c62-4ebc-a29a-3a3e3727bc88",
"guidance_scale": 10,
"init_image": "https://img.freepik.com/premium-photo/red-roses-rose-petals-white-backgroundvalentines-day-concept_167862-5720.jpg,https://huggingface.co/datasets/diffusers/test-arrays/resolve/main/stable_diffusion_inpaint/boy.png",
"init_image_weights": "0.5,0.7",
"n_samples": 1,
"negative_prompt": "A polluted city",
"outdir": "out",
"prompt": "rose man",
"seed": 12345,
"steps": 100
}
}