Reduce image file size while retaining maximum quality by adjusting dimensions, applying modern compression, and stripping embedded metadata.
or click to browse (JPG, PNG, WebP, AVIF)
Vaarcode Image Optimizer helps optimize images and photos with the best compression standards through our web app and Web API for effortless integration into your platforms.
Our API works with any application capable of sending standard HTTP requests, featuring source code samples and full documentation for major stacks:
Integrate Vaarcode Image Optimizer into your applications using HTTP requests in your preferred programming language.
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
public class VaarcodeOptimizer
{
public static async Task OptimizeImageAsync(string inputPath, string outputPath)
{
using var client = new HttpClient();
using var formData = new MultipartFormDataContent();
byte[] imageBytes = await File.ReadAllBytesAsync(inputPath);
formData.Add(new ByteArrayContent(imageBytes), "image", Path.GetFileName(inputPath));
formData.Add(new StringContent("800"), "width");
formData.Add(new StringContent("600"), "height");
formData.Add(new StringContent("webp"), "format");
formData.Add(new StringContent("80"), "quality");
var response = await client.PostAsync("https://imageoptimizer.vaarcode.com/api/optimize", formData);
if (response.IsSuccessStatusCode)
{
byte[] optimizedBytes = await response.Content.ReadAsByteArrayAsync();
await File.WriteAllBytesAsync(outputPath, optimizedBytes);
}
}
}
<?php
function optimizeImage($filePath, $outputPath) {
$ch = curl_init("https://imageoptimizer.vaarcode.com/api/optimize");
$cfile = new CURLFile($filePath, mime_content_type($filePath), basename($filePath));
$data = [
'image' => $cfile,
'width' => 800,
'height' => 600,
'format' => 'webp',
'quality' => 80
];
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
if ($result) {
file_put_contents($outputPath, $result);
}
}
?>
<%@ page import="java.io.*, java.net.*" %>
<%
File file = new File(application.getRealPath("/uploads/photo.jpg"));
String boundary = Long.toHexString(System.currentTimeMillis());
URL url = new URL("https://imageoptimizer.vaarcode.com/api/optimize");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
try (OutputStream out = conn.getOutputStream();
PrintWriter writer = new PrintWriter(new OutputStreamWriter(out, "UTF-8"), true)) {
writer.append("--" + boundary).append("\r\n");
writer.append("Content-Disposition: form-data; name=\"image\"; filename=\"" + file.getName() + "\"").append("\r\n");
writer.append("Content-Type: image/jpeg").append("\r\n\r\n").flush();
FileInputStream in = new FileInputStream(file);
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = in.read(buffer)) != -1) {
out.write(buffer, 0, bytesRead);
}
out.flush();
writer.append("\r\n--" + boundary).append("\r\n");
writer.append("Content-Disposition: form-data; name=\"format\"").append("\r\n\r\nwebp").append("\r\n");
writer.append("--" + boundary).append("\r\n");
writer.append("Content-Disposition: form-data; name=\"quality\"").append("\r\n\r\n80").append("\r\n");
writer.append("--" + boundary + "--").append("\r\n").flush();
}
%>
import requests
from django.http import HttpResponse
def optimize_view(request):
image_file = request.FILES['photo']
response = requests.post(
'https://imageoptimizer.vaarcode.com/api/optimize',
files={'image': (image_file.name, image_file.read(), image_file.content_type)},
data={
'width': 800,
'height': 600,
'format': 'webp',
'quality': 80
}
)
if response.status_code == 200:
return HttpResponse(response.content, content_type=response.headers.get('Content-Type', 'image/webp'))
return HttpResponse('Optimization failed', status=400)
async function optimizeImage(file, width = 800, height = 600, format = 'webp', quality = 80) {
const formData = new FormData();
formData.append('image', file);
if (width) formData.append('width', width);
if (height) formData.append('height', height);
formData.append('format', format);
formData.append('quality', quality);
try {
const response = await fetch('https://imageoptimizer.vaarcode.com/api/optimize', {
method: 'POST',
body: formData
});
if (!response.ok) throw new Error('Optimization failed');
const blob = await response.blob();
const optimizedUrl = URL.createObjectURL(blob);
return optimizedUrl;
} catch (error) {
console.error('Error optimizing image:', error);
}
}
Reducing image size while maintaining adequate photo quality provides substantial performance and efficiency benefits for modern web apps.
Significantly reduces file payloads so web apps load quicker, leading to lower bounce rates and better retention.
Saves mobile and roaming data requirements for clients accessing your applications on limited network plans.
Consumes far less bandwidth on servers when delivering content to larger concurrent user bases.
Lowers computing power and transfer energy, contributing to greener digital infrastructure and web sustainability.
Automatically strips sensitive embedded EXIF metadata such as GPS coordinates, camera details, timestamps, and owner names.
Delivers lightweight web pages that ensure smooth, responsive user interactions across all devices.
Designed with a commitment to total user privacy, developer convenience, and transparency.
No login, no signup, and no credit card required. Pure accessibility with complete source code integration samples provided.
We do not store any photos uploaded via our web app or API on our servers. Files are processed directly in memory and sent back to the client without touching disk storage.
Full support for WebP, AVIF, JPG, and PNG formats. WebP is configured as our default output format for best compression and maximum performance efficiency.
Vaarcode Image Optimizer is entirely funded by donations from users who value our services. We do not run advertisements or accept corporate sponsorships.
Support independent, ad-free web infrastructure for as little as 1 Euro.
Common questions about image optimization and Vaarcode services.
No. We operate under a strict Zero Storage Policy. Photos uploaded via the web app or API are processed in memory and immediately sent back to you without being stored on disk.
We support WebP, AVIF, JPG, and PNG formats. WebP is set as our default format to ensure maximum compression efficiency and quality.
No. No login, signup, or credit card details are ever required. You can integrate our API using the provided documentation and code samples completely free.
We are funded purely by voluntary donations from users who like our service. Contributions as small as 1 Euro help cover our daily hosting and server costs.