Redraw Image

The redraw_image endpoint allows users to modify or recreate a given image using a specified mask and text prompt. This API is ideal for use cases such as creating customized visuals, refining designs, or replacing specific parts of an image while retaining its original structure.

API Endpoint

To redraw an image, send a POST request to the following URL:

POST https://api.genaifactory.ai/v1/redraw_image

Headers

Name
Type
Required
Description

formacloud-api-key

string

Yes

API key required for authenticating your request.

Request Body

The request body should be sent as form-data and include the following fields:

Name
Type
Required
Description

user_input

string

No

A brief textual description (max 200 characters) for guiding the image redrawing process.

original_image

file

No

The original image file to be redrawn. Must not be provided with original_image_url.

original_image_url

string

No

URL of the original image to be redrawn. Must not be provided with original_image.

mask_image

file

No

Mask file specifying areas to be redrawn. Must not be provided with mask_image_url.

mask_image_url

string

No

URL of the mask file specifying areas to be redrawn. Must not be provided with mask_image.

Note: Either the file or the url must be provided for both the original image and the mask but not both simultaneously.

Response Body

Asynchronous Response (Status Code 202)

Name
Type
Required
Description

task_id

string

Yes

The ID of the task created for redrawing the image.

tasks_ahead_count

int

Yes

Number of tasks ahead in the queue when this task is created.

estimate_image_time

int

Yes

Estimated time (in seconds) to complete the task based on recent data.

Failure Response (Status Code 4XX or 5XX)

Name
Type
Required
Description

error

string

Yes

A descriptive error message indicating what went wrong with the request.


Example Request

Using curl Command

curl --location 'https://api.genaifactory.ai/v1/redraw_image' \
--header 'formacloud-api-key: abc' \
--form 'user_input="movie poster says \"FORMA CLOUD\""' \
--form 'original_image_url="https://replicate.delivery/pbxt/M0gpKVE9wmEtOQFNDOpwz1uGs0u6nK2NcE85IihwlN0ZEnMF/kill-bill-poster.jpg"' \
--form 'mask_image_url="https://replicate.delivery/pbxt/M0gpLCYdCLbnhcz95Poy66q30XW9VSCN65DoDQ8IzdzlQonw/kill-bill-mask.png"'

Example Response

Asynchronous Response

{
  "task_id": "task_1234567890abcdef",
  "tasks_ahead_count": 2,
  "estimate_image_time": 120
}

Failure Response

{
  "error": "user_input must be less than 200 characters"
}

Last updated