Super Resolution Endpoint
Overview
Stable Diffusion APIs Super Resolution API returns a super resolution version of an image that is passed to the url
attribute.
Request
--request POST 'https://stablediffusionapi.com/api/v5/super_resolution' \
Send a POST
request to https://stablediffusionapi.com/api/v5/super_resolution endpoint to return the corresponding super resolution image of the image passed.
Watch the how-to video to see it in action.
Body Attributes
Parameter | Description |
---|---|
key | Your API Key used for request authorization |
url | URL of the image that you want in super resolution |
scale | A number for scaling the image |
model_id | upscale model to use, default is realesr-general-x4v3 |
webhook | Set an URL to get a POST API call once the image generation is complete. |
face_enhance | A boolean flag (true/false) for face enhancement feature |
The following upscale models are supported:
Model ID | Description |
---|---|
RealESRGAN_x4plus | 4x upscaling model |
RealESRNet_x4plus | 4x upscaling model |
RealESRGAN_x4plus_anime_6B | 4x Anime upscaling model |
RealESRGAN_x2plus | 2x upscaling model |
realesr-general-x4v3 | 4x upscaling general model |
Want more upscale models? Request a custom model by contacting us at our Discord server.
Example
Body
Body Raw
{
"key": "",
"url": "https://stable-diffusion-api.s3.amazonaws.com/generations/1668922501_1-0.png",
"scale": 3,
"webhook": null,
"face_enhance": false
}
Request
- JS
- PHP
- NODE
- PYTHON
- JAVA
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"key": "",
"url": "https://stable-diffusion-api.s3.amazonaws.com/generations/1668922501_1-0.png",
"scale": 3,
"webhook": null,
"face_enhance": false
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://stablediffusionapi.com/api/v5/super_resolution", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
<?php
$payload = [
"key" => "",
"url" => "https://stable-diffusion-api.s3.amazonaws.com/generations/1668922501_1-0.png",
"scale" => 3,
"webhook" => null,
"face_enhance" => false
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://stablediffusionapi.com/api/v5/super_resolution',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://stablediffusionapi.com/api/v5/super_resolution',
'headers': {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"key": "",
"url": "https://stable-diffusion-api.s3.amazonaws.com/generations/1668922501_1-0.png",
"scale": 3,
"webhook": null,
"face_enhance": false
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
import json
url = "https://stablediffusionapi.com/api/v5/super_resolution"
payload = json.dumps({
"key": "",
"url": "https://stable-diffusion-api.s3.amazonaws.com/generations/1668922501_1-0.png",
"scale": 3,
"webhook": None,
"face_enhance": False
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"key\": \"\",\n \"url\": \"https://stable-diffusion-api.s3.amazonaws.com/generations/1668922501_1-0.png\",\n \"scale\": 3,\n \"webhook\": null,\n \"face_enhance\": false\n}");
Request request = new Request.Builder()
.url("https://stablediffusionapi.com/api/v5/super_resolution")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Response
{
"status": "success",
"generationTime": 12.782328367233276,
"id": 2912600,
"output":"https://pub-8b49af329fa499aa563997f5d4068a4.r2.dev/generations/1675767485_out.png"
}