Skip to main content

Image Guided Editing Endpoint

Overview

V5 Picture to Picture endpoint is used to edit an image using a text prompt with the description of the desired changes.

Pass the image URL with the init_image parameter and add your description of the expected result to the prompt parameter.

Picture to picture endpoint result

Request

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

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

Watch the how-to video to see it in action.

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
init_imageLink to the initial image
image_guidance_scaleImage guidance scale
stepsNumber of denoising steps
guidance_scaleScale for classifier-free guidance (minimum: 1; maximum: 20)

Example

Body

Body
{
"key": "",
"init_image" : "https://d1okzptojspljx.cloudfront.net/generations/b3341a09-082e-474e-989f-72ec3f3bf7aa-0.png",
"prompt" : "make him woman",
"image_guidance_scale" : 1,
"steps" : 50,
"guidance_scale" : 7
}

Request

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

var raw = JSON.stringify({
"key": "",
"init_image" : "https://d1okzptojspljx.cloudfront.net/generations/b3341a09-082e-474e-989f-72ec3f3bf7aa-0.png",
"prompt" : "make him woman",
"image_guidance_scale" : 1,
"steps" : 50,
"guidance_scale" : 7
});

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

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

Response

Example Response
{
"status": "success",
"generationTime": 4.5880513191223145,
"id": 14624464,
"output": "https://pub-8b49af329fae499aa563997f5d4068a4.r2.dev/generations/186bd505-607d-4627-bf00-dcf3b35bfdab-0.png"
}