Skip to main content

Relight


Relight

POST https://api.novita.ai/v3/relight

Relight API helps you to enhance or change the illumination of images.

Request header parameters

  • Content-TypestringRequired

    undefined

    Enum:
    application/json
  • AuthorizationstringRequired

    Bearer authentication format, for example: Bearer {{API Key}}.

Request Body parameters

  • extraobject

    Optional extra parameters for the request.

    Show properties
  • image_filestringRequired

    The base64 of original image, with a maximum resolution of 2048 * 2048 and a max file size of 30 Mb.

  • model_namestringRequired

    This parameter specifies the name of the model checkpoint. Only SD1.x models are allowed. Retrieve the corresponding sd_name value by invoking the https://novita.ai/reference/model/query_model.html API with filter.types=checkpoint as the query parameter.

  • lighting_preferencestringRequired

    The lighting preference. If you specify it as USE_BACKGROUND_IMAGE, then you must initialize the background_image_file value.

    Enum:
    LEFT_LIGHT RIGHT_LIGHT TOP_LIGHT BOTTOM_LIGHT USE_BACKGROUND_IMAGE
  • background_image_filestring

    The base64 of background image, with a maximum resolution of 2048 * 2048 and a max file size of 30 Mb. If you specify it as USE_BACKGROUND_IMAGE, then this parameter is required. Please note that the image_file and background_image_file should have the same resolution.

  • promptstringRequired

    Positive prompt word for the desired background, divided by `,`, Range [1, 1024].

  • negative_promptstring

    Text input that will not guide the image generation, divided by `,`, Range [1, 1024].

  • clip_skipinteger

    This parameter indicates the number of layers to stop from the bottom during optimization, so clip_skip on 2 would mean, that in SD1.x model where the CLIP has 12 layers, you would stop at 10th layer, Range [1, 12], get reference at https://novita.ai/get-started/Misc.html#what-s-clip-skip.

  • stepsintegerRequired

    The number of denoising steps. More steps usually can produce higher quality images, but take more time to generate, Range [1, 100].

  • sampler_namestringRequired

    This parameter determines the denoising algorithm employed during the sampling phase of Stable Diffusion. Each option represents a distinct method by which the model incrementally generates new images. These algorithms differ significantly in their processing speed, output quality, and the specific characteristics of the images they generate, allowing users to tailor the image generation process to meet precise requirements. Get reference at https://novita.ai/get-started/Misc.htmll#what-is-samplers.

    Enum:
    Euler aEulerLMSHeunDPM2DPM2 aDPM++ 2S aDPM++ 2MDPM++ SDEDPM fastDPM adaptiveLMS KarrasDPM2 KarrasDPM2 a KarrasDPM++ 2S a KarrasDPM++ 2M KarrasDPM++ SDE KarrasDDIMPLMSUniPC
  • seedintegerRequired

    A seed is a number from which Stable Diffusion generates noise, which, makes generation deterministic. Using the same seed and set of parameters will produce identical image each time, minimum -1.

  • strengthnumber(float)┬ŽnullRequired

    Range [0, 1]. Conceptually, indicates how much to transform the reference `input_images`. Must be between 0 and 1. `input_images` will be used as a starting point, adding more noise to it the larger the `strength`. The number of denoising steps depends on the amount of noise initially added. When `strength` is 1, added noise will be maximum and the denoising process will run for the full number of iterations specified in `steps`. A value of 1, therefore, essentially ignores `input_images`.

  • guidance_scalenumber(float32)Required

    This setting says how close the Stable Diffusion will listen to your prompt, higer guidance forces the model to better follow the prompt, but result in lower quality output.Range [1, 30].

Responses

  • image_filestring

    The Base64-encoded content of the returned image.

  • image_typestring

    The returned image type.

    Enum:
    png webp jpeg

Example

Relight API helps you to enhance or change the illumination of images.

Request:

curl --location --request POST 'https://api.novita.ai/v3/relight' \
--header 'Authorization: Bearer {{key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
 "extra": {
        "response_image_type": "jpeg"
    },
    "model_name": "realisticVisionV40_v40VAE_81510.safetensors",
    "prompt": "handsome man, realistic, sun and beach",
    "negative_prompt": "(worst quality, low quality:1.2)",
    "lighting_preference": "LEFT_LIGHT",
    "image_file": "{{The base64 encoding of the input image}}",
    "steps": 25,
    "sampler_name": "DPM++ 2M Karras",
    "seed": -1,
    "strength": 0.9,
    "guidance_scale": 6.5,
}'

HTTP status codes in the 2xx range indicate that the request has been successfully accepted. Code 400 means there is an error with the request parameters, while status codes in the 5xx range indicate internal server errors.

You can get images url in image_file of response in base64 format.

Response:

{
  "image_file": "{{The base64 of returned image_file}}"
  "image_type": "jpeg"
}
novita.ai API
novita.ai API