Skip to main content

Upload Base64 Image and Crop

Overview

Stable Diffusion V3 APIs Upload Base64 Image and Crop endpoint is used to upload an image and crop it. Pass the appropriate request parameters to the endpoint.

Request

--request POST 'https://stablediffusionapi.com/api/v3/base64_crop' \

Send a POST request to https://stablediffusionapi.com/api/v3/base64_crop endpoint.

note

Make sure you are passing the image in base64 format.

Body Attributes

ParameterTypeDescription
keyStringYour API Key used for request authorization
imageStringImage to be uploaded converted in base64 format
cropStringA (true/false) flag for cropping the image upon uploading

Example

Body

Body Raw
{
"key": "",
"image": "data:image/png;base64,your_base_64_string",
"crop": "true"
}

Request

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

var raw = JSON.stringify({
"key": "",
"image": "data:image/png;base64,your_base_64_string",
"crop": "true"
});

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

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

Response

{
"status": "success",
"messege": "image uploaded",
"link": "https://pub-8b49af329fae499aa563997f5d4068a4.r2.dev/generations/2789658481681896990.png"
}