REST API AI Upscaling 2x & 4x

Image Enhancement API

Upscale and enhance images programmatically with a single API call. AI-powered super-resolution for sharp, production-ready results at any scale.

Why Use This API

AI Upscaling

Upscale images 2x or 4x with AI super-resolution. Produces sharp, detailed results without pixelation or artifacts.

Resolution Enhancement

Increase image resolution while preserving fine details, textures, and edges using deep learning models.

Quality Improvement

Sharpen blurry photos, reduce compression artifacts, and improve overall image clarity automatically.

Fast Processing

Get enhanced results in 2-5 seconds. Optimized for batch processing and high-volume workflows.

Quick Start

Start enhancing images in under a minute. Here's how:

  1. Get your API keySign up free to receive your key
  2. Send a request — POST an image to the endpoint with your desired scale
  3. Get the result — Receive an enhanced image in the response
curl -X POST https://precisioncounter.com/api/v1/enhance-image \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "image=@photo.jpg" \
  -F "scale=2x" \
  -o enhanced.png
import requests

response = requests.post(
    "https://precisioncounter.com/api/v1/enhance-image",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    files={"image": open("photo.jpg", "rb")},
    data={"scale": "2x"}
)

with open("enhanced.png", "wb") as f:
    f.write(response.content)
const fs = require("fs");
const FormData = require("form-data");

const form = new FormData();
form.append("image", fs.createReadStream("photo.jpg"));
form.append("scale", "2x");

const response = await fetch(
  "https://precisioncounter.com/api/v1/enhance-image",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_API_KEY",
      ...form.getHeaders()
    },
    body: form
  }
);

const buffer = Buffer.from(await response.arrayBuffer());
fs.writeFileSync("enhanced.png", buffer);

API Reference

Base URL

https://precisioncounter.com/api/v1

Authentication

All requests require an API key passed in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Enhance Image

POST /api/v1/enhance-image

Enhances and upscales an uploaded image using AI super-resolution and returns the improved result.

Request Parameters

Parameter Type Description
image required file The image file to enhance. Accepted formats: PNG, JPG, JPEG, WebP. Max size: 10 MB.
scale optional string Upscale factor. Default: 2x. Options: 2x, 4x.
quality optional string Enhancement quality. Default: standard. Options: standard, hd.

Response

200 OK — Returns the enhanced image as binary data with Content-Type: image/png.

Response Headers

Header Value
Content-Type image/png or image/webp
X-Credits-Remaining Number of API credits remaining
X-Processing-Time Processing time in milliseconds

Code Examples

Full Examples with Error Handling

import requests
import sys

API_KEY = "YOUR_API_KEY"
API_URL = "https://precisioncounter.com/api/v1/enhance-image"

def enhance_image(input_path, output_path="enhanced.png", scale="2x"):
    """Enhance and upscale an image file."""
    with open(input_path, "rb") as img:
        response = requests.post(
            API_URL,
            headers={"Authorization": f"Bearer {API_KEY}"},
            files={"image": img},
            data={"scale": scale, "quality": "hd"}
        )

    if response.status_code == 200:
        with open(output_path, "wb") as f:
            f.write(response.content)
        print(f"Saved to {output_path}")
        print(f"Credits remaining: {response.headers.get('X-Credits-Remaining')}")
    else:
        print(f"Error {response.status_code}: {response.json()['error']}")

enhance_image("photo.jpg", scale="4x")
const fs = require("fs");
const FormData = require("form-data");
const fetch = require("node-fetch");

const API_KEY = "YOUR_API_KEY";
const API_URL = "https://precisioncounter.com/api/v1/enhance-image";

async function enhanceImage(inputPath, outputPath = "enhanced.png", scale = "2x") {
  const form = new FormData();
  form.append("image", fs.createReadStream(inputPath));
  form.append("scale", scale);
  form.append("quality", "hd");

  const response = await fetch(API_URL, {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${API_KEY}`,
      ...form.getHeaders()
    },
    body: form
  });

  if (response.ok) {
    const buffer = Buffer.from(await response.arrayBuffer());
    fs.writeFileSync(outputPath, buffer);
    console.log(`Saved to ${outputPath}`);
    console.log(`Credits: ${response.headers.get("x-credits-remaining")}`);
  } else {
    const error = await response.json();
    console.error(`Error ${response.status}: ${error.error}`);
  }
}

enhanceImage("photo.jpg", "enhanced.png", "4x");
<?php
$api_key = "YOUR_API_KEY";
$url = "https://precisioncounter.com/api/v1/enhance-image";

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL => $url,
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $api_key"
    ],
    CURLOPT_POSTFIELDS => [
        "image" => new CURLFile("photo.jpg"),
        "scale" => "2x",
        "quality" => "hd"
    ]
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 200) {
    file_put_contents("enhanced.png", $response);
    echo "Image enhanced successfully\n";
} else {
    echo "Error $httpCode: $response\n";
}
?>
package main

import (
    "bytes"
    "fmt"
    "io"
    "mime/multipart"
    "net/http"
    "os"
)

func enhanceImage(inputPath, outputPath, scale string) error {
    file, _ := os.Open(inputPath)
    defer file.Close()

    body := &bytes.Buffer{}
    writer := multipart.NewWriter(body)
    part, _ := writer.CreateFormFile("image", inputPath)
    io.Copy(part, file)
    writer.WriteField("scale", scale)
    writer.WriteField("quality", "hd")
    writer.Close()

    req, _ := http.NewRequest("POST",
        "https://precisioncounter.com/api/v1/enhance-image", body)
    req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
    req.Header.Set("Content-Type", writer.FormDataContentType())

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        return err
    }
    defer resp.Body.Close()

    if resp.StatusCode == 200 {
        out, _ := os.Create(outputPath)
        defer out.Close()
        io.Copy(out, resp.Body)
        fmt.Printf("Saved to %s\n", outputPath)
    }
    return nil
}

func main() {
    enhanceImage("photo.jpg", "enhanced.png", "2x")
}
require "net/http"
require "uri"

api_key = "YOUR_API_KEY"
uri = URI("https://precisioncounter.com/api/v1/enhance-image")

form_data = [
  ["image", File.open("photo.jpg", "rb")],
  ["scale", "2x"],
  ["quality", "hd"]
]

req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{api_key}"
req.set_form(form_data, "multipart/form-data")

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(req)
end

if res.code == "200"
  File.binwrite("enhanced.png", res.body)
  puts "Image enhanced successfully"
else
  puts "Error #{res.code}: #{res.body}"
end
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");

using var form = new MultipartFormDataContent();
var imageContent = new ByteArrayContent(File.ReadAllBytes("photo.jpg"));
imageContent.Headers.ContentType = new("image/jpeg");
form.Add(imageContent, "image", "photo.jpg");
form.Add(new StringContent("2x"), "scale");
form.Add(new StringContent("hd"), "quality");

var response = await client.PostAsync(
    "https://precisioncounter.com/api/v1/enhance-image", form);

if (response.IsSuccessStatusCode)
{
    var result = await response.Content.ReadAsByteArrayAsync();
    File.WriteAllBytes("enhanced.png", result);
    Console.WriteLine("Image enhanced successfully");
}

Error Handling

The API returns standard HTTP status codes with JSON error bodies:

Status Meaning Description
200 Success Image enhanced successfully. Response body is the output image.
400 Bad Request Missing image file, unsupported format, invalid scale, or file too large.
401 Unauthorized Missing or invalid API key.
429 Rate Limited Too many requests. Wait and retry with exponential backoff.
500 Server Error Internal processing error. Retry the request.

Error Response Format

{
  "error": "Invalid scale value. Accepted: 2x, 4x",
  "code": "INVALID_PARAMETER",
  "status": 400
}

Rate Limits

Plan Requests / Minute Max File Size Max Resolution
Free 10 10 MB 4096 x 4096 px
Pro 60 25 MB 8192 x 8192 px

Rate limit headers are included in every response:

X-RateLimit-Limit: 10
X-RateLimit-Remaining: 7
X-RateLimit-Reset: 1708646400

Use Cases

  • E-commerce product photos
  • Social media content upscaling
  • Print preparation and high-res output
  • Old photo enhancement
  • Real estate listing images
  • Thumbnail generation and improvement

Pricing

Free to Start

Get free API credits when you sign up. No credit card required.

Frequently Asked Questions

What image formats does the Image Enhancement API support?
The API accepts PNG, JPG, JPEG, and WebP images as input. Enhanced images are returned in PNG or WebP format depending on your preference.
What upscaling options are available?
The API supports 2x and 4x upscaling. A 2x upscale doubles the image dimensions, while 4x quadruples them. Both use AI-powered super-resolution for sharp, artifact-free results.
Is the Image Enhancement API free?
Yes. You get free API credits when you sign up. No credit card is required to get started.
How long does image enhancement take?
Most images are enhanced in 2-5 seconds depending on the image size and upscale factor. 2x upscaling is faster than 4x. Higher resolution images may take slightly longer.
Does the API improve quality without upscaling?
Yes. You can use the quality parameter set to hd without specifying a scale factor to sharpen and improve the overall quality of an image at its original resolution.
What is the maximum file size for the Image Enhancement API?
The maximum file size per request is 10 MB on the free plan and 25 MB on the Pro plan. For best results and fastest processing, images under 5 MB are recommended.
Can I use the Image Enhancement API for commercial projects?
Yes. The API can be used for both personal and commercial applications, including e-commerce product photos, real estate listings, social media content, and SaaS products.