TextSharp API Documentation
Complete API reference for integrating TextSharp AI text image enhancer into your applications.
Overview
The TextSharp API provides powerful AI text image enhancement capabilities through a simple REST interface. Our API uses advanced machine learning algorithms to sharpen text edges, reduce noise, and improve contrast in images containing text.
Base URL
https://www.pixfinal.com/api⚠️ API Key Required
All API calls require authentication using an API key. You can get your API key from the dashboard.
Endpoints
POST
/deblur-apiEnhance text in images using our AI text image enhancer. Requires API key authentication.
Request
URL: https://www.pixfinal.com/api/deblur-api
Method: POST
Content-Type: multipart/form-data
Headers: X-API-Key: your_api_key_here
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| file | File | Yes | Image file to enhance (PNG, JPG, JPEG, WEBP) |
Code Examples
cURL
# Basic usage with API key
curl -X POST https://www.pixfinal.com/api/deblur-api \
-H "X-API-Key: your_api_key_here" \
-F "file=@document.png" \
--output enhanced.pngJavaScript/Node.js
// Using fetch API with API key
async function enhanceImage(imageFile, apiKey) {
const formData = new FormData();
formData.append('file', imageFile);
try {
const response = await fetch('https://www.pixfinal.com/api/deblur-api', {
method: 'POST',
headers: {
'X-API-Key': apiKey
},
body: formData
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const result = await response.json();
if (result.code === 0) {
// Use the enhanced image
const img = document.createElement('img');
img.src = result.data.url; // Base64 data URL
document.body.appendChild(img);
} else {
console.error('Enhancement failed:', result.message);
}
} catch (error) {
console.error('Error:', error);
}
}
// Usage with file input
document.getElementById('fileInput').addEventListener('change', (e) => {
const file = e.target.files[0];
const apiKey = 'your_api_key_here'; // Get from dashboard
if (file) {
enhanceImage(file, apiKey);
}
});Python
import requests
import base64
from PIL import Image
import io
def enhance_image(image_path, api_key, output_path=None):
"""
Enhance text in an image using TextSharp API
"""
url = "https://www.pixfinal.com/api/deblur-api"
with open(image_path, 'rb') as f:
files = {'file': f}
headers = {'X-API-Key': api_key}
response = requests.post(url, files=files, headers=headers)
if response.status_code == 200:
result = response.json()
if result['code'] == 0:
# Save enhanced image
if output_path:
# Decode base64 data
image_data = result['data']['url'].split(',')[1] # Remove data:image/png;base64,
image_bytes = base64.b64decode(image_data)
with open(output_path, 'wb') as f:
f.write(image_bytes)
return result
else:
raise Exception(f"Enhancement failed: {result['message']}")
else:
raise Exception(f"HTTP error: {response.status_code}")
# Usage
try:
api_key = "your_api_key_here" # Get from dashboard
result = enhance_image('document.png', api_key, 'enhanced_document.png')
print(f"Enhanced image saved successfully")
except Exception as e:
print(f"Error: {e}")Error Handling
Common Error Codes
401 - Invalid API key402 - Insufficient credits400 - Invalid file format or missing file413 - File too large (max 50MB)Error Response Format
{
"code": -1,
"message": "Error description"
}Rate Limits
Credits System
- • Credits Required: 1 credit per successful image enhancement
- • File Size: 50MB maximum per request
- • Concurrent Requests: 5 simultaneous requests per API key
- • Authentication: API key required for all requests
