简体   繁体   English

SVG在Node中的PNG中具有外部png

[英]SVG with external png inside to PNG in Node

Is there a node-package which is able to convert an svg to png from an external image inside the svg-file like this? 是否有一个节点程序包能够将svg-file的外部图像从svg转换为png

 <?xml version="1.0" encoding="utf-8"?> <svg viewBox="0 0 120 120" height="120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <rect x="0" y="0" width="120" height="120" fill="lightgreen"/> <image xlink:href="https://upload.wikimedia.org/wikipedia/commons/d/d6/MicroQR_Example.png" x="10" y="10" width="100px"/> </svg> 

At the moment I use http://sharp.dimens.io/ for the conversion, but I could not find a way to resize and save it to a png without loosing the inner external image: onnly the rect is visible afterwards. 目前,我使用http://sharp.dimens.io/进行了转换,但是我找不到不丢失内部外部图像就可以调整大小并将其保存为png的方法:之后只能看到rect :/ :/

It would be nice if you could tell me any package I could use to get the above code working :) 如果您能告诉我可以用来使上述代码起作用的任何软件包,那就太好了:)

Thanks in advance. 提前致谢。

终于我有了一个解决方案,在Mac上,我不得不安装一些其他软件包,现在它正在运行: https : //github.com/lovell/package-libvips-darwin/blob/master/.travis.yml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM