

About this tool
Shrinks the file size of your pictures and picks the best file type for each one by itself. Smaller pictures load faster on websites and are easier to send by e-mail. You can optionally give a size you would like to stay under, and choose to keep or drop the hidden details stored in the file (like the camera and date).
For example, you shrink a 6 MB holiday photo to a few hundred KB so it fits in an e-mail.
How to use it
- Choose this tool.
- Add one or more pictures with Upload or drag and drop.
- If you like, set the largest file size you want, or keep the hidden details.
- Press Generate.
- Download the smaller pictures.
What you get back
You get a smaller copy of each picture that you can download, and the original stays untouched.
GOOD TO KNOW
Candidate formats/quality tiers are chosen by the server (at most 6 candidates); the response includes the full decision.
TEST IT LIVE
Try Auto-Optimize in the Studio
One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Family
Images
Plan
Free
Method
POST
Endpoint
/v1/images/auto-optimize
Tool ID
images.auto-optimize
Authentication
API key
Accepts
JPEG, PNG, WEBP, GIF, AVIF, TIFF +15 more
Background jobs
Yes
Usage group
Image
For developers
Use it from your code
cURL
curl -X POST "https://app.h2i.davixlabs.io/v1/images/auto-optimize" \
-H "X-Api-Key: $DAVIX_H2I_API_KEY" \
-F 'images=@photo.jpg' \
-F 'maxSizeKB=1' \
-F 'colorSpace=srgb' \
-F 'output_bundle=zip'Node.js
const { DavixH2I } = require('@davixlabs/h2i-sdk');
const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.images.autoOptimize({
"images": 'photo.jpg',
"maxSizeKB": 1,
"colorSpace": "srgb",
"output_bundle": "zip"
});
console.log(result.data, result.requestId);PHP
<?php
require 'vendor/autoload.php';
$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->images()->autoOptimize([
'images' => 'photo.jpg',
'maxSizeKB' => 1,
'colorSpace' => 'srgb',
'output_bundle' => 'zip',
]);
echo $result->requestId;Documentation
Guides that use this tool
More in Images
