svg2png

package module
v0.0.0-...-3faaba0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2022 License: MIT Imports: 3 Imported by: 0

README

Go Report Card

svg2png

Description

Very simple SVG to PNG converter library using the Inkscape.

Installation

go get github.com/mskrha/svg2png

Usage

package main

import (
	"fmt"

	"github.com/mskrha/svg2png"
)

func main() {
	var input []byte

	// Fill the input with SVG image

	converter := svg2png.New()

	output, err := converter.Convert(input)
	if err != nil {
		fmt.Println(err)
		return
	}

	// Read the output PNG image
}

Documentation

Index

Constants

View Source
const (
	/*
		Default inkscape binary path
	*/
	BINARY = "/usr/bin/inkscape"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Converter

type Converter struct {
	// contains filtered or unexported fields
}

func New

func New() *Converter

Return a new instance of the converter

func (*Converter) Convert

func (c *Converter) Convert(in []byte) (out []byte, err error)

Try to convert the input SVG to the PNG image

func (*Converter) SetBinary

func (c *Converter) SetBinary(b string) error

Set custom inkscape binary path instead of the default

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL