Skip to main content

Image to 3D

Overview

This endpoint generates 3D image from image while passing appropriate parameters.

Request

--request POST 'https://modelslab.com/api/v3/img_to_3d' \

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

Body Attributes

ParameterDescriptionValues
keyYour API Key used for request authorization.key
imageLink to the initial image.url
stepsNumber of denoising steps.21, 31, 41
guidance_scaleScale for classifier-free guidance.Minimum: 1, Maximum: 20
frame_sizeNumber of frames for the 3D image.
seedSeed used to reproduce results. Pass null for a random number.integral value
secondsNumber of seconds for the 3D image animation.
batch_sizeNumber of images per prompt.
safety_checkerA checker for NSFW images. If detected, replaces with a blank image.true or false
webhookURL to receive a POST API call once image generation is complete.url
track_idID returned in the response to the webhook API call for identification.integral value

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":31,
"frame_size":128,
"batch_size":10,
"seed":20,
"safety_checker":"no",
"seconds":4,
"webhook": null,
"track_id": null
}

Request

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":31,
"frame_size":128,
"webhook": null,
"track_id": null
});

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

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

Response

{
"status": "success",
"generationTime": 6,
"id": 109656316,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/36b6d54b-4443-49f7-817d-b42511bae879.gif"
],
"meta": {
"batch_size": 4,
"file_prefix": "fbd026b6-5217-4b77-9fa4-dea8438d5ee9",
"frame_size": 128,
"guidance_scale": 15,
"image": "https://img.freepik.com/premium-photo/red-roses-rose-petals-white-backgroundvalentines-day-concept_167862-5720.jpg",
"instant_response": "no",
"n_samples": 1,
"outdir": "out",
"output_type": "gif",
"safetychecker": "no",
"seconds": 3,
"seed": 20,
"steps": 31,
"temp": "no"
}
}