https://github.com/mrdotb/resvg_nif
:pencil2: Elixir NIF bindings for the Resvg library.
https://github.com/mrdotb/resvg_nif
elixir png rustler svg
Last synced: about 2 months ago
JSON representation
:pencil2: Elixir NIF bindings for the Resvg library.
- Host: GitHub
- URL: https://github.com/mrdotb/resvg_nif
- Owner: mrdotb
- License: mit
- Created: 2023-06-13T15:00:02.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2025-03-12T09:48:59.000Z (3 months ago)
- Last Synced: 2025-04-04T06:03:25.118Z (about 2 months ago)
- Topics: elixir, png, rustler, svg
- Language: Elixir
- Homepage: https://hexdocs.pm/resvg/readme.html
- Size: 1010 KB
- Stars: 27
- Watchers: 3
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Resvg (Rust NIFs for elixir)
[](https://github.com/mrdotb/resvg_nif/workflows/Tests/badge.svg)
[](https://hex.pm/packages/resvg)
[](https://hexdocs.pm/resvg)
[](https://hex.pm/packages/resvg)
[](https://github.com/mrdotb/resvg_nif/blob/master/LICENSE.md)Native Implemented Function (NIF) bindings for the [resvg](https://github.com/RazrFalcon/resvg) library.
About resvg from its documentation:
> resvg is an SVG rendering library. The core idea is to make a fast, small, portable SVG library with the goal to support the whole SVG spec.## Installation
The package can be installed
by adding `resvg_nif` to your list of dependencies in `mix.exs`:```elixir
def deps do
[
{:resvg, "~> 0.5.0"}
]
end
```## Usage
Convert svg to png with:
```elixir
:ok = Resvg.svg_to_png("input.svg", "output.png")svg_string = """
"""
:ok = Resvg.svg_string_to_png(svg_string, "output.png", resources_dir: "/tmp")
```## Livebook introduction
Easiest way to get started and try more advanced example is is to run the Livebook.
[](https://livebook.dev/run?url=https%3A%2F%2Fgithub.com%2Fmrdotb%2Fresvg_nif%2Fblob%2Fmaster%2Flivebooks%2Fexample.livemd)
## Contributing
You can contribute to resvg_nif. Please check the [CONTRIBUTING.md](CONTRIBUTING.md) guide for more information.
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to our [CODE_OF_CONDUCT.md](/CODE_OF_CONDUCT.md).
### How to release a new version to hex
1. Update the version in both `mix.exs` and `README.md`.
2. Tag the commit with the version number, for example: `git tag v0.4.0 commit_hash`.
3. Push the commit and the tag using: `git push origin master && git push --tags`.
4. Wait for the CI to generate all the NIFs.
5. Generate the NIF checksum with: `mix rustler_precompiled.download Resvg.Native --all`.
6. Verify that the generated checksum is correct.
7. Publish the package with: `mix hex.publish`.Let me know if you'd like to adjust anything further!
## Copyright and LicenseCopyright (c) 2023 Mrdotb
This work is free. You can redistribute it and / or modify it under the terms of the MIT License. See the LICENSE.md file for more details.