Free plan

SVG edit

Change colours, size or shape of an SVG without a special program
POST
/v1/images/svg-edit

About this tool

An SVG is a picture made of lines and shapes, which stays sharp at any size. This tool lets you change one without a drawing program: swap colours, remove parts, resize, crop or add space around it, add a background, turn or mirror it. Anything in the file that could run code is removed. You can save the result as an SVG or as a normal PNG picture.
For example, you change the main colour of your logo from red to green and turn it into a PNG.

How to use it

  1. Choose this tool.
  2. Add your SVG file with Upload or drag and drop.
  3. Set the changes you want, such as colours to swap, size, turning or mirroring.
  4. Choose whether to save as SVG or PNG.
  5. Press Generate, then download the result.

What you get back

You get the edited picture as an SVG or PNG file to download. Your original file is not changed.
GOOD TO KNOW
The file is cleaned before and after (scripts, event handlers, external references and foreign objects are dropped). Selectors are a tag, #id and .class combinations only. Counts as one image per file.
TEST IT LIVE

Try SVG edit in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Images
Plan
Free
Method
POST
Endpoint
/v1/images/svg-edit
Tool ID
images.svg-edit
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-edit" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'images=@photo.jpg' \
  -F 'replace_colors={"#ff0000":"#00aa00"}' \
  -F 'remove=["#background",".debug"]' \
  -F 'set_attributes={"#logo":{"opacity":"0.5"}}'

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.svgEdit({
    "images": 'photo.jpg',
    "replace_colors": "{\"#ff0000\":\"#00aa00\"}",
    "remove": "[\"#background\",\".debug\"]",
    "set_attributes": "{\"#logo\":{\"opacity\":\"0.5\"}}"
  });
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()->svgEdit([
    'images' => 'photo.jpg',
    'replace_colors' => '{"#ff0000":"#00aa00"}',
    'remove' => '["#background",".debug"]',
    'set_attributes' => '{"#logo":{"opacity":"0.5"}}',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Edit an SVG without a vector editor: swap colours, remove elements, set attributes, resize, crop or pad the canvas, add a background, turn or mirror it, and save it as SVG or PNG. Nothing that can run code survives.

SVG edit accepts JPEG, PNG, WEBP, GIF, AVIF, TIFF, SVG, SVGZ, BMP, ICO, APNG, PNM and 9 more. You can send several files in one request.

SVG edit is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/images/svg-edit with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.