Image Upscaling
Introduction
Upscaling refers to the process of enhancing the resolution and overall quality of images. This technique is particularly useful for improving the visual clarity and detail of lower-resolution images, making them suitable for various high-definition applications.
Request
Our API always accepts an array of objects as input, where each object represents a specific task to be performed. The structure of the object varies depending on the type of the task. For this section, we will focus on the parameters related to the image upscaling task.
The following JSON snippets shows the basic structure of a request object. All properties are explained in detail in the next section.
taskType
The type of task to be performed. For this task, the value should be
imageUpscale
.taskUUID
When a task is sent to the API you must include a random UUID v4 string using the
taskUUID
parameter. This string is used to match the async responses to their corresponding tasks.If you send multiple tasks at the same time, the
taskUUID
will help you match the responses to the correct tasks.The
taskUUID
must be unique for each task you send to the API.inputImage
Specifies the input image to be processed. The image can be specified in one of the following formats:
- An UUID v4 string of a previously uploaded image or a generated image.
- A data URI string representing the image. The data URI must be in the format
data:<mediaType>;base64,
followed by the base64-encoded image. For example:data:image/png;base64,iVBORw0KGgo...
. - A base64 encoded image without the data URI prefix. For example:
iVBORw0KGgo...
. - A URL pointing to the image. The image must be accessible publicly.
Supported formats are: PNG, JPG and WEBP.
The maximum size of the upscaled result is 4096x4096 pixels. If the combination of input size and upscale factor would exceed this limit, the input image will be automatically resized. For example, a 2048x2048 image with an
upscaleFactor
of 4 will first be reduced to 1024x1024 to ensure the final result stays within limits.outputType
Specifies the output type in which the image is returned. Supported values are:
dataURI
,URL
, andbase64Data
.base64Data
: The image is returned as a base64-encoded string using theimageBase64Data
parameter in the response object.dataURI
: The image is returned as a data URI string using theimageDataURI
parameter in the response object.URL
: The image is returned as a URL string using theimageURL
parameter in the response object.
outputFormat
Specifies the format of the output image. Supported formats are:
PNG
,JPG
andWEBP
.includeCost
If set to
true
, the cost to perform the task will be included in the response object.upscaleFactor
This value is the level of upscaling performed.
Each will increase the size of the image by the corresponding factor.
For instance, an
upscaleFactor
of2
will 2x image size.
Response
Results will be delivered in the format below.
taskUUID
The API will return the
taskUUID
you sent in the request. This way you can match the responses to the correct request tasks.imageUUID
The unique identifier of the image.
imageURL
If
outputType
is set toURL
, this parameter contains the URL of the image to be downloaded.imageBase64Data
If
outputType
is set tobase64Data
, this parameter contains the base64-encoded image data.imageDataURI
If
outputType
is set todataURI
, this parameter contains the data URI of the image.cost
if
includeCost
is set totrue
, the response will include acost
field for each task object. This field indicates the cost of the request in USD.