1.0.0-alpha.8 • Published 2 years ago
@hiogawa/svg-rust-nodejs v1.0.0-alpha.8
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
- background
- font
- embed font data to binary
- nodejs binding
- deploy on aws lambda
- testing and CI
- build for multi platform
- hack unsupported
dominant-baseline
- low quality when resizing image
- manually preprocess e.g. via https://github.com/hi-ogawa/imageflow-node-aws-lambda
references
1.0.0-alpha.8
2 years ago
1.0.0-alpha.7
2 years ago
1.0.0-alpha.6
2 years ago
1.0.0-alpha.5
2 years ago
1.0.0-alpha.4
2 years ago
1.0.0-alpha.3
2 years ago
1.0.0-alpha.2
2 years ago
1.0.0-alpha.1
2 years ago
1.0.0-alpha.0
2 years ago