Commercial API & WordPress Plugin Access
The Webp Converter REST API and WordPress Plugin require an active $49 Lifetime Single-Site License. Each key is permanently locked to 1 website.
Conversion Parameters Live Stream
Drop Image or Click to Browse
Supports JPG, PNG, WEBP, AVIF, BMP
An active single-site API key is required to convert images through the API.
85%
Live Response Ready
Select an image on the left and click Send API Request to preview output.
Original Size:
—
Converted Output:
—
Compression Ratio:
—
// Click "Send API Request" to view live response headers.
WooCommerce Auto-WebP Optimization Hook
Add this code to your active WordPress theme's
functions.php or custom pluginEvery time a product or media image is uploaded to your WooCommerce store, this hook intercepts the upload, streams it to your Webp Converter REST API in RAM, and saves the WebP version automatically.
<?php
/**
* Auto Convert WooCommerce Image Uploads to WebP via Webp Converter API
* Add this code to your child theme's functions.php
*/
add_filter('wp_handle_upload', function($upload) {
if (empty($upload['file']) || !empty($upload['error'])) {
return $upload;
}
$mime = $upload['type'] ?? '';
// Only convert raster JPG and PNG images
if (!in_array($mime, ['image/jpeg', 'image/png'], true)) {
return $upload;
}
$filePath = $upload['file'];
if (!file_exists($filePath)) {
return $upload;
}
// Your Webp Converter API Endpoint & $49 Lifetime Key
$apiEndpoint = 'https://webpconverter.tech/api/convert.php';
$apiKey = 'CZ-YOUR-API-KEY';
$cFile = new CURLFile($filePath, $mime, basename($filePath));
$ch = curl_init($apiEndpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-Key: ' . $apiKey,
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'image' => $cFile,
'format' => 'webp',
'quality' => 85,
'response_type' => 'binary',
'site_url' => home_url()
]);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$webpData = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode === 200 && !empty($webpData)) {
$webpPath = preg_replace('/\.(jpe?g|png)$/i', '.webp', $filePath);
if (file_put_contents($webpPath, $webpData)) {
// Remove original image to save disk space
@unlink($filePath);
$upload['file'] = $webpPath;
$upload['url'] = preg_replace('/\.(jpe?g|png)$/i', '.webp', $upload['url']);
$upload['type'] = 'image/webp';
}
}
return $upload;
}, 10, 1);
cURL Command Line
curl -X POST "https://webpconverter.tech/api/convert.php" \ -H "X-API-Key: CZ-YOUR-API-KEY" \ -F "image=@photo.jpg" \ -F "format=webp" \ -F "quality=85" \ --output photo.webp
Python Requests
import requests
url = "https://webpconverter.tech/api/convert.php"
headers = {"X-API-Key": "CZ-YOUR-API-KEY"}
files = {"image": open("banner.png", "rb")}
data = {"format": "webp", "quality": 85}
response = requests.post(url, headers=headers, files=files, data=data)
if response.status_code == 200:
with open("banner.webp", "wb") as f:
f.write(response.content)
print("Successfully converted image to WebP!")
else:
print("Error:", response.json())
Node.js (Axios & FormData)
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
const form = new FormData();
form.append('image', fs.createReadStream('banner.jpg'));
form.append('format', 'webp');
form.append('quality', 85);
axios.post('https://webpconverter.tech/api/convert.php', form, {
headers: {
...form.getHeaders(),
'X-API-Key': 'CZ-YOUR-API-KEY'
},
responseType: 'arraybuffer'
}).then(res => {
fs.writeFileSync('banner.webp', res.data);
console.log('Saved converted WebP successfully!');
}).catch(err => {
console.error('API Error:', err.message);
});