We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
webkit2png. 原始版本仅适用于 OSX,但幸运的是有一个跨平台分支:
https://github.com/AdamN/python-webkit2png
webkit2png. The original version is OSX-only, but luckily there is a cross-platform fork:
https://github.com/AdamN/python-webkit2png
要扩展 vartec 的答案并解释如何使用它...
安装 webkit2png< /strong>
最简单的方法可能是简单地克隆 github 存储库并运行安装程序。
这需要已经安装 python 和 git。
对于 cygwin,这会将 webkit2png 作为命令添加到路径中。我还没有在其他终端/操作系统上测试过这个。
运行它
假设您的网站位于当前目录中。 (我有一个使用 css 样式表的 html 文件 - 但无需考虑 css 文件。)
选项
webkit2png -h
告诉我们:值得注意的选项是宽度和高度的设置。
疑难解答
使用cygwin,我遇到了
webkit2png:无法连接到X服务器:0.0
。为了解决这个问题(我已经执行了
export DISPLAY=0.0
),我必须启动一个 X-Server。在 cygwin 上,这可以通过在第二个终端中运行startxwin
来完成。确保首先通过 cygwin 安装程序安装它。To expand on vartec's answer to also explain how to use it...
Install webkit2png
The easiest way is probably to simply clone the github repo and run the setup.
This requires python and git to already be installed.
For cygwin, this will add webkit2png as a command to the path. I haven't tested this for other terminals/OS.
Run it
Say you have your website in the current directory. (I had a html file that was using a css stylesheet - but there's no need to think about the css file.)
Options
webkit2png -h
informs us:Notable options are the setting of width and height.
Troubleshooting
Using cygwin, I encountered
webkit2png: cannot connect to X server :0.0
.To fix this (I had already performed
export DISPLAY=0.0
), I had to start an X-Server. On cygwin, this can be done by runningstartxwin
in a second terminal. Make sure to install it first via the cygwin setup.