【问题标题】:Is there a way to save highcharts output as png instead of html有没有办法将 highcharts 输出保存为 png 而不是 html
【发布时间】:2023-10-03 21:26:01
【问题描述】:

我正在查看以下 python 库: Link here

我认为它不能将输出保存为 .png 或 .jpeg。

我在谷歌上冲浪了很多,有人可以给我一些指导吗?

谢谢

【问题讨论】:

标签: python highcharts


【解决方案1】:

不,highcharts 包不提供该功能。您可以编辑他们的代码,或者查看将 html 转换为 png 的包。比如https://github.com/AdamN/python-webkit2png

你可以从 python 调用这个包

import subprocess
subprocess.call("python scripts/webkit2png -h", shell=True)

【讨论】:

  • 嗨,我不想打开浏览器,因为这将在 linux 机器上完成,我没有浏览器。加上截图确实添加了图片,但最后还有额外的黑色块。
  • webkit2png 不需要浏览器。编辑了我的帖子。
  • 愚蠢的问题,如何将它添加到我的 python 脚本中? import webkit2png webkit2png("path to the html")
  • 它是一个单独的程序。请参阅我的答案中的 sn-p :)
相关资源