Skip to content

Upscaler

PRICING

This page describes API for upscaling/super-resolution service for images. The API follows the general rules of Ximilar API as described in Section First steps.

This service API has three endpoints (synchronous) running at URLs:

https://api.ximilar.com/upscaler/2x/upscale
https://api.ximilar.com/upscaler/4x/upscale
https://api.ximilar.com/upscaler/8x/upscale

Activate and try the service in Ximilar App

In order to get access to the Upscaler service, please register at https://app.ximilar.com and then click on this Service on the main panel to make it accessible for your Ximilar account.

Synchronous endpoint

Be aware to use asynchronous requests in production. Synchronous requests are only for testing purposes and should be used for smaller images that can be processed in reasonable time (minute).

We recommend to call this service with asynchronous requests, not waiting on the results and possible to processing more requests and bigger images.

Pricing

Pricing of the upscaling service is not based on specific api endpoint (like /2x/upscale vs /4x/upscale) but on the output (upscaled) image size. For example upscaling 500px image with /2x/upscale endpoint costs the same as upscaling 250px image with /4x/upscale endpoint, which equals to Upscale XS operation (25-30 credits). In general GAN model (available in output) is providing better outputs, but it is also a bit more expensive. For more information see pricing page.

Upscaling endpoint: /[2x|4x|8x]/upscale

Given a list of image records, this method enhance resolution for each of them. The upscaled image are stored temporarily for 24 in _upscaled_image_url field of json record. Right now two endpoints which increase resolution by 2, 4 or 8 times are available.

Parameters:

  • records: list with one photo to upscale (only one record/photo is possible)
    • must contain either of _url or _base64 field - see section image data for details
  • mode: settings of the upscaling process (default artifact_removal)
    • artifact_removal - remove artifacts
    • ironed_out - the features and edges are more smooth
    • high_fidelity - getting as much details as possible, no post processing
  • model_type: - Optional field, if not specified classic model will be used
    • gan - setting for using generative model (better details but more artificiall image)
  • image_format - Optional field (string), if not specified it will try preserve the format of input image data (images with alpha channel will be converted to png, otherwise to jpg). Available options are png, jpg, webp.
  • image_quality - Optional field (int), default is 85. Only available when submitting image_format.

$ curl https://api.ximilar.com/upscaler/2x/upscale -H "Content-Type: application/json" -H "Authorization: Token __API_TOKEN__" -d '{
    "records": [
        { "_url": "https://bit.ly/2IymQJv" }
    ]
}'

Returns:

  • HTTP error code 2XX, if the method was OK and other HTTP error code, if the method failed.
  • Body of the response is a JSON object (map) with the following fields:
    • status - a JSON map with a status of the method processing. It contains these subfields:
      • code - a numeric code of the operation status; it follows the concept of HTTP status codes (2XX, 4XX). Specific codes are described for each type of answer (or operation) (see below).
      • text - a text describing the status code
      • error_description - in case of the processing ended with error (codes 4XX), this field contains a detailed description of the error; this might include Java stack traces.
    • Example of statuses that can be returned:
      "status": {"code": 200, "text": "OK"}
      "status": {"code": 402, "text": "aborted by error", error_description="..."}
      "status": {"code": 500, "text": "unknown error", "error_description": "..."}
    • statistics - a map of various statistics about the processing. The only statistic included every time is
      • processing time - time of actual processing of the query [in seconds]
    • records - JSON array with the input records, each record enriched by field _upscaled_image_url with url path to the upscaled image. This image is available for download for 24 hours.
CLICK TO SHOW JSON RESULT

{
  "records": [
    {
      "_status": {
        "code": 200,
        "text": "OK",
        "request_id": "722c88b5-bcba-4892-b38c-4934f8c45206"
      },
      "_url": "https://bit.ly/2IymQJv",
      "_id": "2b0e486d-41a4-4035-8854-d8bae4137b0a",
      "_width": 1380,
      "_height": 868,
      "_upscaled_height": 1736,
      "_upscaled_width": 2760,
      "_upscaled_image_url": "https://s3-eu-west-1.amazonaws.com/ximilar-tmp-images/upscale/929aac7c-d77e-4eec-91f3-4a8b0b426e07.jpg"
    }
  ],
  "statistics": {
    "processing time": 3.422583818435669
  },
  "status": {
    "code": 200,
    "text": "OK",
    "request_id": "722c88b5-bcba-4892-b38c-4934f8c45206",
    "proc_id": "073c4119-2523-41bb-aa74-9b56cb4f5876"
  }
}