Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

marmelab/svg_to_png

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

archived Archived Repository
This code is no longer maintained. Feel free to fork it, but use it at your own risks.

svg_to_png

An svg to png converter using chrome in headless mode.

Usage

You can pipe an svg to the command:

svg_to_png < myImage.svg

You can specify file(s) as arguments:

svg_to_png myImage.svg myImage2.svg

It's also possible to start an http-server:

svg_to_png --http

The server will listen to POST requests containing the svg as their body and will return the data-url for the converted PNG in the response body.

Running in a container

cat kiwi.svg | docker run -i svg_to_png

Note the -i which is required for piping to work.

Another option would be to run this container as an http-server (could be part of a docker-compose for use from another API):

docker run --rm -p 3000:3000 --security-opt seccomp=unconfined --name svg_to_png marmelab/svg_to_png --http

The --security-opt seccomp=unconfined is currently required so that we can run chrome inside the container and access it from the API.

Development

Install dependencies:

npm install
# or
yarn

Build the cli:

npm run build

The built cli will be available in the ./dist folder.

Build the cli with pkg:

npm run pkg

The built binaries will be available in the ./build folder.

About

Convert an SVG file to a PNG image. Uses headless Chrome for rendering.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published