teamon / rsvg

Render SVG into PNG in Elixir
13 stars 3 forks source link

RSVG

⚠️ WARNING: This is an experimental proof of concept. Read the code, use at your own risk ⚠️

Elixir library to render SVG into PNG using librsvg.

Usage

# Get some SVG (read from file, generate in memory, etc.)
svg = File.read!("example.svg")

# Render into PNG
png = RSVG.render(svg, :png)

# Write to file (or serve via phoenix/plug)
File.write!("example.png", png)

Installation

If available in Hex, the package can be installed by adding rsvg to your list of dependencies in mix.exs:

def deps do
  [
    {:rsvg, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/rsvg.