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:
- Get your API key — Sign up free to receive your key
- Send a request — POST an image to the endpoint with your desired scale
- 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
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
Get free API credits when you sign up. No credit card required.
Frequently Asked Questions
quality parameter set to hd without specifying a scale factor to sharpen and improve the overall quality of an image at its original resolution.