POST
/
img2img
Generate image from image
curl --request POST \
  --url https://modelslab.com/api/v6/images/img2img \
  --header 'Content-Type: application/json' \
  --data '{
  "key": "<string>",
  "prompt": "<string>",
  "negative_prompt": "<string>",
  "width": 512,
  "height": 512,
  "samples": 1,
  "num_inference_steps": 31,
  "safety_checker": false,
  "safety_checker_type": "sensitive_content_text",
  "seed": 123,
  "guidance_scale": 7.5,
  "use_karras_sigmas": true,
  "algorithm_type": "none",
  "vae": "<string>",
  "lora_strength": "<string>",
  "lora_model": "<string>",
  "clip_skip": 2,
  "base64": false,
  "temp": false,
  "webhook": "<string>",
  "track_id": "<string>",
  "ip_adapter_id": "ip-adapter_sdxl",
  "ip_adapter_scale": 0.5,
  "ip_adapter_image": "<string>",
  "scheduler": "DDPMScheduler",
  "model_id": "<string>",
  "init_image": "<string>",
  "strength": 0.5
}'
{
  "status": "success",
  "generationTime": 123,
  "id": 123,
  "output": [
    "<string>"
  ],
  "proxy_links": [
    "<string>"
  ],
  "meta": {},
  "nsfw_content_detected": true,
  "webhook_status": "<string>",
  "tip": "<string>"
}
The dimensions of the generated image will be the same as the dimensions of the init_image.
You can find a list of the public models available and their IDs here
Image to image endpoint result

Request

Make a POST request to below endpoint and pass the required parameters as a request body to the endpoint.
curl
--request POST 'https://modelslab.com/api/v6/images/img2img' \

Body

json
{  
    "key": "your_api_key",  
    "model_id": "realistic-vision-51",  
    "prompt": "women playing tennis",  
    "negative_prompt": null,  
    "init_image": "https://i.pinimg.com/736x/20/ab/3d/20ab3df5c180e1cae812020bcfeb3093.jpg",  
    "samples": "1",  
    "num_inference_steps": "31",  
    "safety_checker": "yes",   
    "guidance_scale": 7.5,  
    "strength": 0.7,  
    "scheduler": "UniPCMultistepScheduler",  
    "seed": null,  
    "lora_model": null,  
    "use_karras_sigmas": "yes",  
    "vae": null,  
    "lora_strength": null,  
    "webhook": null,  
    "track_id": null
}

Body

application/json

Response

Image-to-image generation response

The response is of type object.