Skip to main content

Regen API

The Regen API is an API that provides functionality to regenerate masked parts of an image using AI. When an empty string ("") is passed as the prompt, the focus is on removing the objects within the masked area to blend naturally with the surroundings. However, if something is written in the prompt, the focus shifts to adding that object, modifying the image accordingly.


Authentication

header
X-Photio-Key : {PHOTIO_API_KEY}

Do you not have an API key yet?

To call the API, you first need to obtain a Photio API key. To get your API key, go to the API Dashboard. After registering your card, you can use the issued API key.


Request Body

VariableTypeRequireDefaultDescription
promptstring""This is a description of the image you want to create, provided in English. It should include a detailed depiction of the scene or object you'd like to generate.
base_imagestring-This can be either a base image in base64 format or an image URL. The output generated by the AI will match the dimensions of the input base image (e.g., input size 1024*1024 will produce output of the same size). The recommended pixel size for images is as below
mask_imagestring-This can be either a mask_image image in base64 format or an image URL. The mask_image has to be same size with base_image. Mask black(0) would be edited with AI.
negative_promptstring"worst quality, low quality, illustration, 3d, 2d, painting, cartoons, sketch"Enter in English any objects or scenarios you do not want to appear in the image. If nothing is entered, a default negative prompt will be used, which includes: "worst quality, low quality, illustration, 3d, 2d, painting, cartoons, sketch."
qualitystring"LOW"Choose from three levels of quality: "LOW", "MIDDLE", "HIGH". The default is "LOW". Setting the quality to "HIGH" will increase the detail quality of the generated image but will also take more time. A "LOW" quality setting results in relatively lower detail quality but faster generation speed.
seedint-1This variable allows for the creation of different outcomes even with the same input. It can be set to any integer between 1 and 4,294,967,296. If you enter -1 or leave this field blank, a random seed number will be used to generate the image.
cfg_scalefloat2.5This setting determines how closely the AI should follow the prompt. A higher cfg_scale (e.g., 2.5) means the AI will strictly adhere to the prompt and not add extraneous elements. Lower cfg_scale settings allow the AI more freedom to incorporate various elements into the image. Recommend value range is 1.0~2.5
curl --request POST
--url https://api.photio.io/v1/inference/regen
--header 'X-Photio-Key: {X-Photio-Key}'
--header 'Content-Type: application/json'
--data '{ "prompt": "starfish", "mask_image": "https://imagedelivery.net/zea4eJK186SeWjCFHvF-jQ/4f52374e-a0ca-4e79-362a-1fda8b079100/1k", "base_image": "https://imagedelivery.net/zea4eJK186SeWjCFHvF-jQ/4038d802-f40e-4f77-0733-dd09308ff800/1k" }'
TagRatioPixel size
Fullscreen4:31152x896
Widescreen16:91344x768
Ultrawide21:91536x640
Mobile landscape3:21216x832
Square1:11024x1024
Mobile Portrait2:3832x1216
Tall9:16768x1344

Response

VariableTypeDescription
status_codeintIn the response, you can find a status value to check the status of the request. A normal response is indicated by 200, authentication issues by 401, and API status problems by a 500 error.
bodystringThe result image data is output as a Base64-encoded string.
Response Example
{
"status_code": Int,
"body": Base64 String
}

Output Example Generate API Example Image