# Image Upscale API

### About

Our Image Upscaling API streamlines the process of enhancing image resolution and size by factors of 2x, 4x, and 8x using advanced Super-Resolution models. Tailored for developers, designers, and content creators, this API offers a convenient solution for improving image quality without compromising details.

Integrating our API into your workflow is seamless. Simply send a POST request to the respective endpoint—`/upscale2x/`, `/upscale4x/`, or `/upscale8x/`—with the URL of the image to be upscaled in the request body. The API then applies the chosen upscaling factor to enhance the image resolution.

The output format of the API response is a JPEG image, preserving the upscaled version of the input image. This standardized format ensures compatibility with a wide range of applications and platforms, facilitating easy integration into your projects.

Use cases for our Image Upscaling API encompass various scenarios, including:

* Enhancing image quality for digital media platforms
* Preparing images for high-definition displays or printing
* Improving image details for machine learning training datasets
* Enhancing visual content for marketing materials and presentations

By automating the image upscaling process, our API saves valuable time and resources, empowering you to deliver visually stunning content efficiently. Whether you're developing a photo editing application, optimizing website images, or enhancing machine learning datasets, our Image Upscaling API provides the functionality you need to achieve exceptional results. Elevate your image processing capabilities and unlock new possibilities with our Image Upscaling API.

### CURL and Response

#### Request

{% tabs %}
{% tab title="Curl" %}

```bash
curl -X 'POST' \
  'https://api.magicapi.dev/api/v1/magicapi/upscaler/upscale2x/' \
  -H 'accept: image/jpeg' \
  -H 'x-magicapi-key: API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "url": "https://production-media.paperswithcode.com/datasets/Set5-0000002728-07a9793f_zA3bDjj.jpg"
}'
```

{% endtab %}

{% tab title="NodeJS" %}

```bash
const fetch = require('node-fetch');

let url = 'https://api.magicapi.dev/api/v1/magicapi/upscaler/upscale2x/';

let options = {
  method: 'POST',
  headers: {'x-magicapi-key': 'SOME_STRING_VALUE', 'content-type': 'application/json'},
  body: '{"url":"https://production-media.paperswithcode.com/datasets/Set5-0000002728-07a9793f_zA3bDjj.jpg"}'
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error('error:' + err));
```

{% endtab %}

{% tab title="Python" %}

```bash
import http.client

conn = http.client.HTTPSConnection("api.magicapi.dev")

payload = "{\"url\":\"https://production-media.paperswithcode.com/datasets/Set5-0000002728-07a9793f_zA3bDjj.jpg\"}"

headers = {
    'x-magicapi-key': "SOME_STRING_VALUE",
    'content-type': "application/json"
    }

conn.request("POST", "/api/v1/magicapi/upscaler/upscale2x/", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
```

{% endtab %}

{% tab title="Java" %}

```bash
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"url\":\"https://production-media.paperswithcode.com/datasets/Set5-0000002728-07a9793f_zA3bDjj.jpg\"}");
Request request = new Request.Builder()
  .url("https://api.magicapi.dev/api/v1/magicapi/upscaler/upscale2x/")
  .post(body)
  .addHeader("x-magicapi-key", "SOME_STRING_VALUE")
  .addHeader("content-type", "application/json")
  .build();

Response response = client.newCall(request).execute();
```

{% endtab %}

{% tab title="PHP" %}

```bash
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.magicapi.dev/api/v1/magicapi/upscaler/upscale2x/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"url\":\"https://production-media.paperswithcode.com/datasets/Set5-0000002728-07a9793f_zA3bDjj.jpg\"}",
  CURLOPT_HTTPHEADER => [
    "content-type: application/json",
    "x-magicapi-key: SOME_STRING_VALUE"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

{% endtab %}
{% endtabs %}

#### Responses :

### For `/upscale2x/`&#x20;

<div align="center"><figure><img src="/files/WkQ0zfeESYoxfuz7c3e7" alt=""><figcaption><p>Original</p></figcaption></figure></div>

<figure><img src="/files/oStKKieim4AoccUMHhQu" alt=""><figcaption><p>Upscaled-2x</p></figcaption></figure>

<figure><img src="/files/tImWn3P7koH5vhGbAgCX" alt=""><figcaption><p>Original</p></figcaption></figure>

<figure><img src="/files/CMQ0lqWT2A0YitmDi43g" alt=""><figcaption><p>Upscaled-2x</p></figcaption></figure>

<figure><img src="/files/lXHZpXg5K2poBHfVrK0f" alt=""><figcaption><p>Original</p></figcaption></figure>

<figure><img src="/files/xVZ3zIFCYjdQVGQElC5z" alt=""><figcaption><p>Upscaled-2x</p></figcaption></figure>

### For `/upscale4x/`

<figure><img src="/files/WkQ0zfeESYoxfuz7c3e7" alt=""><figcaption><p>Original</p></figcaption></figure>

<figure><img src="/files/QidH3t71OPUHnVeQsqiw" alt=""><figcaption><p>Upscaled-4x</p></figcaption></figure>

<figure><img src="/files/tImWn3P7koH5vhGbAgCX" alt=""><figcaption><p>Original</p></figcaption></figure>

<figure><img src="/files/zbuVJ0GEFYA5uIFO1iXB" alt=""><figcaption><p>Upscaled-4x</p></figcaption></figure>

<figure><img src="/files/lXHZpXg5K2poBHfVrK0f" alt=""><figcaption><p>Original</p></figcaption></figure>

<figure><img src="/files/oPWa7R0oNSoZDNykLE1o" alt=""><figcaption><p>Upscaled-4x</p></figcaption></figure>

### For `/upscale8x/`

<figure><img src="/files/WkQ0zfeESYoxfuz7c3e7" alt=""><figcaption><p>Original</p></figcaption></figure>

<figure><img src="/files/UvgL1pi31lBENDAr02nI" alt=""><figcaption><p>Upscaled-8x</p></figcaption></figure>

<figure><img src="/files/tImWn3P7koH5vhGbAgCX" alt=""><figcaption><p>Original</p></figcaption></figure>

<figure><img src="/files/Py4NSMSAoasUn1xs0sFN" alt=""><figcaption><p>Upscaled-8x</p></figcaption></figure>

<figure><img src="/files/VZJaBLvf83eiMDxFNcxr" alt=""><figcaption><p>Original</p></figcaption></figure>

<figure><img src="/files/JcsWklMXG0dFS7VJbbNp" alt=""><figcaption><p>Upscaled-8x</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.api.market/api-product-docs/magicapi/image-upscale-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
