Skip to main content

Outpainting Endpoint

Overview

This endpoint helps to outpaint by expanding the giving image

Outpainting endpoint result

Request

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

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

Body Attributes

ParameterDescriptionValues
keyYour API Key used for request authorizationkey
promptText prompt with a description of the things you want in the image to be generatedstring
negative_promptItems you don't want in the imagestring
imageLink or provide valid base64 data which follows the format data:image/jpeg;base64,{your_base64_string} to the image you want your generations to resembleURL or base64 string
widthMax Height: Width: 1024x1024The maximum is 1024 pixels
heightMax Height: Width: 1024x1024The maximum is 1024 pixels
walk_typeList of values from left, right, up, down, and backward. For example, if you want to pan to the right for a few steps and then zoom out, you must provide: ["right", "right", "backward"]A list of values from left, right, up, down, backward
width_translation_per_stepThe distance (in pixels) to translate the image on the x-axis while outpainting. Applies to walk types of left, right, and backward. Default: 32pxThe default is 32 pixels
height_translation_per_stepThe distance (in pixels) to translate the image on the y-axis while outpainting. Applies to walk types of up, down, and backward. Default: 32pxThe default is 32 pixels
translation_factorThe factor by which to translate the image on the x-axis and y-axis while outpainting. The calculated width translation per step is translation_factor * width, and similar for height. Provide either translation_factor or both height_translation_per_step and width_translation_per_step. If all three are provided, then translation_factor is ignored. Default: 0.10.1 (0-1)
num_inference_stepsNumber of denoising steps. Default: 20. Min: 1, Max: 50The minimum is 1, and the maximum is 50. The default is 20
num_interpolation_stepsNumber of filler frames to generate between two outpaint walk directions. Default: 60. Max: 120The maximum is 120. The default is 60
as_videoWhether to return the outpainting as a video or image. Should be true or false. If false, the generated image will be the final result generated without any intermediate outpaint steps generated using walk_typeTRUE or FALSE
fpsFPS of the generated video. This requires as_video to be set to true. Default: 120The default is 120. (desired fps)
base64If provided image is in base64 format or if you want your generated images as a base64 string, must be set to true. Default: falseTRUE or FALSE (default: FALSE)
seedSeed is used to reproduce results, same seed will give you the same image in return again. Pass null for a random numberIntegral value
samplesNumber of images to be returned in response. The maximum value is 4The maximum is 4
webhookSet a URL to get a POST API call once the image generation is completeURL
track_idThis ID is returned in the response to the webhook API call. This will be used to identify the webhook requestIntegral value

Example

Body

Body
{
"key":"",
"seed":12345,
"width":512,
"height":512,
"prompt":"a majestic cat house, lush greenery, filled with plants, high quality, cartoonish, realistic, 4k",
"image":"https://i.ibb.co/wp0w7nt/1-d212fe65-f95c-4bbe-b275-99f0dedd901a.png",
"negative_prompt":"dull background, text, characters, symbols, unrealistic, repetitive background, boring background, bad, low quality, black background",
"height_translation_per_step": 64,
"width_translation_per_step":64,
"num_inference_steps": 15,
"as_video":false,
"num_interpolation_steps": 32,
"walk_type":["back", "back", "left","left","up", "up"],
"webhook": null,
"track_id": null
}

Request

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

var raw = JSON.stringify({
"key":"",
"seed":12345,
"width":512,
"height":512,
"prompt":"a majestic cat house, lush greenery, filled with plants, high quality, cartoonish, realistic, 4k",
"image":"https://i.ibb.co/wp0w7nt/1-d212fe65-f95c-4bbe-b275-99f0dedd901a.png",
"negative_prompt":"dull background, text, characters, symbols, unrealistic, repetitive background, boring background, bad, low quality, black background",
"height_translation_per_step": 64,
"width_translation_per_step":64,
"num_inference_steps": 15,
"as_video":false,
"num_interpolation_steps": 32,
"walk_type":["back", "back", "left","left","up", "up"],
"webhook": null,
"track_id": null
});

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

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

Response

Example Response

{
"status": "success",
"generationTime": 6.230603456497192,
"id": 663,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/47b84646-fd81-4aaf-83fd-a25506b3d8d6.png"
],
"proxy_links": [
"https://cdn2.stablediffusionapi.com/generations/47b84646-fd81-4aaf-83fd-a25506b3d8d6.png"
],
"meta": {
"as_video": "no",
"file_prefix": "47b84646-fd81-4aaf-83fd-a25506b3d8d6",
"fps": 120,
"guidance_scale": 8,
"height": 512,
"height_translation_per_step": 64,
"image": "https://i.ibb.co/wp0w7nt/1-d212fe65-f95c-4bbe-b275-99f0dedd901a.png",
"n_samples": 1,
"negative_prompt": "dull background, text, characters, symbols, unrealistic, repetitive background, boring background, bad, low quality, black background",
"num_inference_steps": 15,
"num_interpolation_steps": 60,
"outdir": "out",
"prompt": "a majestic cat house, lush greenery, filled with plants, high quality, cartoonish, realistic, 4k",
"seed": 12345,
"temp": "no",
"translation_factor": null,
"walk_type": [],
"width": 512,
"width_translation_per_step": 64
}
}