drf21989 2013-06-14 09:22
浏览 193
已采纳

将SVG转换为图像

How do I convert an svg file to an image using Go ?

I found the amazing svgo library and would like to use it to generate a custom set of playing cards. The idea is to store the text and layout of a card in a text file and then read and process it with go. This would be a huge improvement of my current workflow where I use gimp to edit each individual card. The problem is that I need to have an image of the card for printing. Preferably png since the printing script so far only works with that format. But I could easily adapt it to accept jpeg, too.

Unfortunately svgo doesn't seem to offer export functionality. Can you recommend a go library to convert svg to png ?

  • 写回答

2条回答 默认 最新

  • dousi2251 2013-06-15 08:00
    关注

    One possible strategy is to write your SVG to files and invoke an external tool to convert them. For example, ImageMagick and its related GraphicsMagick will both convert SVG to PNG via command-line options. You would need to use the convert verb, possibly within their batch support if you're converting lots of images at once.

    GraphicsMagick has bindings for C and other languages that you could use directly from your Go scripts, although I've not tried this myself.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作