node-rsvg

Parse SVG files and render them as PNG, PDF, SVG, or raw memory buffer images.

  • 所有者: walling/node-rsvg
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Node.JS Binding for LibRSVG

LibRSVG is a SVG rendering library, which parses SVG files and renders them in various formats. The formats include:

  • PNG
  • PDF
  • SVG
  • Raw memory buffer image

Build Status

Basic Usage

Here is a simple example. Look in index.js for more documentation.

var Rsvg = require('rsvg').Rsvg;
var fs = require('fs');

// Create SVG render instance.
var svg = new Rsvg();

// When finishing reading SVG, render and save as PNG image.
svg.on('finish', function() {
  console.log('SVG width: ' + svg.width);
  console.log('SVG height: ' + svg.height);
  fs.writeFile('tiger.png', svg.render({
    format: 'png',
    width: 600,
    height: 400
  }).data);
});

// Stream SVG file into render instance.
fs.createReadStream('tiger.svg').pipe(svg);

Installation

First install the LibRSVG library and header files. Usually you have to look for a development package version. You must also have a functioning build tool chain including pkg-config. You can find instructions for different operating systems below. After that, you simply run:

npm install rsvg

Library versions known to work:

  • LibRSVG 2.26+
  • Cairo 1.8.8+

Ubuntu:

sudo apt-get install librsvg2-dev

RedHat / OpenSUSE:

sudo yum install librsvg2-devel

Mac OS X:

brew install librsvg

If, after installing LibRSVG through homebrew you are experiencing issues installing this module, try manually exporting the package config with this command:

export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig

Then try reinstalling this module. For further information, see this thread.

Windows:

N/A; pull requests are accepted!

主要指標

概覽
名稱與所有者walling/node-rsvg
主編程語言C++
編程語言JavaScript (語言數: 4)
平台
許可證MIT License
所有者活动
創建於2013-11-29 15:18:56
推送於2014-05-19 10:46:00
最后一次提交2014-05-19 12:45:27
發布數12
最新版本名稱v0.2.5 (發布於 2014-05-19 12:45:41)
第一版名稱v0.1.0 (發布於 )
用户参与
星數99
關注者數7
派生數48
提交數50
已啟用問題?
問題數10
打開的問題數8
拉請求數1
打開的拉請求數1
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?