Coder Social home page Coder Social logo

svg_to_png's Introduction

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.

svg_to_png's People

Contributors

alexisjanvier avatar djhi avatar willienillie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

svg_to_png's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.