1.0.0-alpha.8 • Published 2 years ago

@hiogawa/svg-rust-nodejs v1.0.0-alpha.8

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

svg-rust-nodejs

# build
cargo build --release

# compare with other svg renderers
cargo build --release --examples
./target/release/examples/demo-resvg   misc/examples/test.svg misc/examples/test.resvg.png 800 600
./target/release/examples/demo-librsvg misc/examples/test.svg misc/examples/test.librsvg.png 800 600
cairosvg misc/examples/test.svg '--background=#ffffff' -o misc/examples/test.cairosvg.png
inkscape misc/examples/test.svg -o                        misc/examples/test.inkscape.png
convert misc/examples/test.svg                            misc/examples/test.convert.png  # internally uses inkscape (if available) or librsvg

# build nodejs binding on local OS
npm run napi:release
node -e 'require("./build/napi/svg-rust-nodejs.linux-x64-gnu.node").svgToPng("misc/examples/test.svg", "misc/examples/test.png")'

# build in napi-rs debian image
docker-compose build builder
docker-compose run -T --rm builder cat build/napi/svg-rust-nodejs.linux-x64-gnu.node > build/napi/svg-rust-nodejs.linux-x64-gnu.node

# publish npm package
npm run release

# hack resvg's unsupported text layout
npm -s -C app run cli ./src/hack-dominant-baseline.ts < misc/examples/test.svg > misc/examples/test.hack1.svg
node -e 'require("./build/napi/svg-rust-nodejs.linux-x64-gnu.node").svgToPng("misc/examples/test.hack1.svg", "misc/examples/test.hack1.png")'

# embed external image href as base64 data url
npm -s -C app run cli ./src/resolve-external-href.ts < misc/examples/test.hack1.svg > misc/examples/test.hack2.svg
node -e 'require("./build/napi/svg-rust-nodejs.linux-x64-gnu.node").svgToPng("misc/examples/test.hack2.svg", "misc/examples/test.hack2.png")'

todo

references