Image to 3D
Overview
This endpoint generates 3D image from image while passing appropriate parameters.
Request
--request POST 'https://stablediffusionapi.com/api/v3/img_to_3d' \
Make a POST
request to https://stablediffusionapi.com/api/v3/img_to_3d endpoint and pass the required parameters as a request body.
Body Attributes
Parameter | Description |
---|---|
key | Your API Key used for request authorization. |
image | Link to the Initial Image |
steps | Number of denoising steps (minimum: 1; maximum: 50) |
guidance_scale | Scale for classifier-free guidance (minimum: 1; maximum: 20) |
frame_size | Number of frame size) |
seed | Seed is used to reproduce results, same seed will give you same image in return again. Pass null for a random number. |
seconds | Number of seconds |
batch_size | Number of images per prompt |
safety_checker | A checker for NSFW images. If such an image is detected, it will be replaced by a blank image. |
webhook | Set an URL to get a POST API call once the image generation is complete. |
track_id | This ID is returned in the response to the webhook API call. This will be used to identify the webhook request. |
Example
Body
Body
{
"key":"",
"image":"https://img.freepik.com/premium-photo/red-roses-rose-petals-white-backgroundvalentines-day-concept_167862-5720.jpg",
"guidance_scale":5,
"steps":64,
"frame_size":128,
"batch_size":10,
"seed":20,
"safety_checker":"no",
"seconds":4,
"webhook": null,
"track_id": null
}
Request
- JS
- PHP
- NODE
- PYTHON
- JAVA
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"key": "",
"image":"https://img.freepik.com/premium-photo/red-roses-rose-petals-white-backgroundvalentines-day-concept_167862-5720.jpg",
"guidance_scale":5,
"steps":64,
"frame_size":128,
"webhook": null,
"track_id": null
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://stablediffusionapi.com/api/v3/img_to_3d", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
<?php
$payload = [
"key" => "",
"image" => "https://img.freepik.com/premium-photo/red-roses-rose-petals-white-backgroundvalentines-day-concept_167862-5720.jpg",
"guidance_scale" => 5,
"steps" => 64,
"frame_size" => 128,
"webhook" => null,
"track_id" => null
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://stablediffusionapi.com/api/v3/img_to_3d',
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/v3/img_to_3d',
'headers': {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"key": "",
"image":"https://img.freepik.com/premium-photo/red-roses-rose-petals-white-backgroundvalentines-day-concept_167862-5720.jpg",
"guidance_scale":5,
"steps":64,
"frame_size":128,
"webhook": null,
"track_id": null
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
import json
url = "https://stablediffusionapi.com/api/v3/img_to_3d"
payload = json.dumps({
"key": "",
"image":"https://img.freepik.com/premium-photo/red-roses-rose-petals-white-backgroundvalentines-day-concept_167862-5720.jpg",
"guidance_scale":5,
"steps":64,
"frame_size":128,
"webhook": None,
"track_id": None
})
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 \"image\":\"https://img.freepik.com/premium-photo/red-roses-rose-petals-white-backgroundvalentines-day-concept_167862-5720.jpg\",\n \"guidance_scale\":5,\n \"steps\":64,\n \"frame_size\":128\n}");
Request request = new Request.Builder()
.url("https://stablediffusionapi.com/api/v3/img_to_3d")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Response
{
"status": "success",
"generationTime": 6,
"id": 326,
"output": [
"https://cdn.stablediffusionapi.com/generations/2d74af44-825c-4cff-9fe9-3716bd40c9fd.gif"
],
"meta": {
"file_prefix": "2d74af44-825c-4cff-9fe9-3716bd40c9fd",
"frame_size": 256,
"guidance_scale": 15,
"negative_prompt": "",
"outdir": "out",
"output_type": "gif",
"prompt": "A birthday cupcake",
"safetychecker": "no",
"seconds": 3,
"seed": 1110454524,
"steps": 64
}
}