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.

Image-Mixer endpoint result

Request​

--request POST 'https://modelslab.com/api/v6/image_editing/img_mixer' \

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

Body Attributes​

ParameterDescriptionValues
keyYour API Key used for request authorizationstring
promptText prompt with description of the things you want in the image to be generatedstring
negative_promptItems you don't want in the imagestring
init_imageAn array of image URLs to mixed. Max: 4 images. Example: "init_image":[ "https://image-url-1.jpg","https://image-url-2.jpg"]URL
widthThe width of the image. Max: 1024 pixelsinteger
heightThe height of the image. Max: 1024 pixelsinteger
stepsNumber of denoising steps. Min: 1. Max: 50integer
guidance_scaleScale for classifier-free guidance. Min: 1. Max: 20float
seedSeed used to reproduce results. Same seed will give you the same image again. Pass null for a random numberinteger, null
samplesNumber of images to be returned in response. Max: 1integer
webhookSet a URL to receive a POST API call once the image generation is completeURL
track_idThis ID is returned in the response to the webhook API call and will be used to identify the webhook requestinteger

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",
"width":800,
"height":600,
"guidance_scale":10,
"steps":41,
"samples":1
}

Request​

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

var raw = JSON.stringify({
"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",
"width":800,
"height":600,
"guidance_scale":10,
"steps":41,
"samples":1
});

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

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

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": 41
}
}