About this tool
An SVG is a picture made of lines and shapes. This tool makes the file smaller by removing everything that is not needed, so it looks the same but loads faster. It also removes anything that could run code, such as scripts. You can choose how many decimals to keep, whether to keep the title text, and whether the result is easy to read or as small as possible. It only works with SVG files.
For example, you shrink a set of website icons so your pages open faster.
How to use it
- Choose this tool.
- Add your SVG files with Upload or drag and drop.
- Leave the settings as they are, or change the precision and what to remove.
- Press Generate.
- Download the smaller SVG files.
What you get back
You get smaller SVG files that look the same. Download them to replace your originals.
GOOD TO KNOW
The SVG is optimized, never run. One file counts as one image, up to 10 MB.
TEST IT LIVE
Try Optimize SVG 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/svg-optimize
Tool ID
images.svg-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/svg-optimize" \
-H "X-Api-Key: $DAVIX_H2I_API_KEY" \
-F 'images=@photo.jpg' \
-F 'precision=3' \
-F 'multipass=true' \
-F 'response=url'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.svgOptimize({
"images": 'photo.jpg',
"precision": 3,
"multipass": true,
"response": "url"
});
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()->svgOptimize([
'images' => 'photo.jpg',
'precision' => 3,
'multipass' => true,
'response' => 'url',
]);
echo $result->requestId;More in Images
