This monorepo contains the following Node.js packages that can convert an SVG into another format using headless Chromium.
These are primarily split up into core packages that support the format-specific packages:
- Core
- JPEG
- PNG
- WEBP
As you can perhaps tell, the format-specific packages follow the below naming convention:
convert-svg-to-<FORMAT>
convert-svg-to-<FORMAT>-cli
Where the first package is intended to be used as a standard library and imported into your own code and the second is intended to be installed and used as a tool via the CLI.
It works by using headless Chromium to take a screenshot of the SVG and outputs the buffer. This does mean that the
supported output formats are limited to those supported by that the API for headless Chromium, however, as more formats
are added, additional packages can easily be created. The CLI packages are installed with puppeteer
which downloads
and installs a headless Chromium instance, however, the others only use puppeteer-core
which means that a Chromium
instance must be provided and connected by the dependant (e.g. using puppeteer
or an executable path).
The core packages are not intended for use outside this monorepo and only serve to aid development and maintenance of the other packages.
Explore the above packages to learn more on how to install and use each one.
If you have any problems with this package or would like to see changes currently in development, you can do so here.
If you want to contribute, you're a legend! Information on how you can do so can be found in CONTRIBUTING.md. We want your suggestions and pull requests!
A list of all contributors can be found in AUTHORS.md.
Copyright © 2025 neocotic
See LICENSE.md for more information on our MIT license.