Convert Your Image
Upload an image and convert it to WebP format with optional resizing
API Documentation
Learn how to integrate the Image to WebP Converter API into your application
Quick Start
Convert an image in one request - three ways to send your image:
# Upload a file
curl -X POST https://webp.abrir.xyz/api/convert-image \
-F "
[email protected]" -o converted.webp
# From URL
curl -X POST https://webp.abrir.xyz/api/convert-image \
-H "Content-Type: application/json" \
-d '{"imageUrl":"https://example.com/image.jpg"}' \
-o converted.webp
# From Base64
curl -X POST https://webp.abrir.xyz/api/convert-image \
-H "Content-Type: application/json" \
-d '{"imageBase64":"data:image/jpeg;base64,/9j/4AAQ..."}' \
-o converted.webp
Endpoint
POST /api/convert-image
Base URL: https://webp.abrir.xyz
Request
Method 1: File Upload (multipart/form-data)
image *
FILE
The image file to convert. Accepts JPG, PNG, GIF, TIFF, WebP, etc.
maxWidth
NUMBER
Maximum width in pixels. Optional. Image scales proportionally if larger.
maxHeight
NUMBER
Maximum height in pixels. Optional. Image scales proportionally if larger.
Method 2: URL (application/json)
imageUrl *
STRING
URL of the image to fetch and convert.
maxWidth
NUMBER
Maximum width in pixels. Optional. Image scales proportionally if larger.
maxHeight
NUMBER
Maximum height in pixels. Optional. Image scales proportionally if larger.
Method 3: Base64 (application/json)
imageBase64 *
STRING
Base64 encoded image data (with or without data URI prefix).
maxWidth
NUMBER
Maximum width in pixels. Optional. Image scales proportionally if larger.
maxHeight
NUMBER
Maximum height in pixels. Optional. Image scales proportionally if larger.
Response
Successful conversion returns the WebP image with metadata in headers:
X-Original-Width
Original image width in pixels
X-Original-Height
Original image height in pixels
X-Final-Width
Final image width in pixels
X-Final-Height
Final image height in pixels
Code Examples
cURL - File Upload
curl -X POST https://webp.abrir.xyz/api/convert-image \
-F "
[email protected]" \
-F "maxWidth=1920" \
-o converted.webp
cURL - From URL
curl -X POST https://webp.abrir.xyz/api/convert-image \
-H "Content-Type: application/json" \
-d '{"imageUrl":"https://example.com/image.jpg","maxWidth":1920}' \
-o converted.webp
cURL - From Base64
curl -X POST https://webp.abrir.xyz/api/convert-image \
-H "Content-Type: application/json" \
-d '{"imageBase64":"data:image/jpeg;base64,/9j/4AAQ...","maxWidth":1920}' \
-o converted.webp
JavaScript - File Upload
const formData = new FormData();
formData.append('image', fileInput.files[0]);
formData.append('maxWidth', '1920');
const response = await fetch('https://webp.abrir.xyz/api/convert-image', {
method: 'POST',
body: formData
});
const blob = await response.blob();
JavaScript - From URL
const response = await fetch('https://webp.abrir.xyz/api/convert-image', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
imageUrl: 'https://example.com/image.jpg',
maxWidth: 1920
})
});
const blob = await response.blob();
Python - File Upload
import requests
files = {'image': open('photo.jpg', 'rb')}
data = {'maxWidth': '1920', 'maxHeight': '1080'}
response = requests.post(
'https://webp.abrir.xyz/api/convert-image',
files=files,
data=data
)
with open('converted.webp', 'wb') as f:
f.write(response.content)
Python - From URL
import requests
response = requests.post(
'https://webp.abrir.xyz/api/convert-image',
json={
'imageUrl': 'https://example.com/image.jpg',
'maxWidth': 1920
}
)
with open('converted.webp', 'wb') as f:
f.write(response.content)
n8n Integration
Automate image conversion in your n8n workflows.
Setup Steps
1. Add an HTTP Request node
2. Set Method: POST
3. Set URL: https://webp.abrir.xyz/api/convert-image
4. Body Type: Form Data (Multipart)
Common Use Cases
- Batch convert images from a folder
- Auto-convert images from email attachments
- Sync and resize images from Google Drive
- Create webhook for on-demand conversions
- Send converted images to Slack/Discord
Form Data Fields
image
BINARY
Connect from "Read Binary File" or other file source
maxWidth
NUMBER
e.g., {{1920}}
maxHeight
NUMBER
e.g., {{1080}}
Access Response Data
// Image dimensions
{{$json.headers["x-original-width"]}}
{{$json.headers["x-original-height"]}}
{{$json.headers["x-final-width"]}}
{{$json.headers["x-final-height"]}}
// Binary data for saving
{{$json.body}}
Status Codes
200
Success - WebP image returned
400
Bad Request - Missing image or invalid parameters
405
Method Not Allowed - Use POST only
500
Server Error - Check image format and size
Limits & Info
- Max file size: 6MB
- WebP quality: 80
- Timeout: 30 seconds
- Formats: JPG, PNG, GIF, TIFF, WebP, SVG, BMP, ICO, HEIF