如何使用Python拍摄网站的屏幕截图/图片? [英] How can I take a screenshot/image of a website using Python?

查看:97
本文介绍了如何使用Python拍摄网站的屏幕截图/图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要实现的是从python中的任何网站获取网站截图.

What I want to achieve is to get a website screenshot from any website in python.

Env:Linux

Env: Linux

推荐答案

在Mac上,有 webkit2png ,并且在Linux + KDE上,您可以使用 khtml2png .我已经尝试了前者,并且效果很好,并且听说后者已投入使用.

On the Mac, there's webkit2png and on Linux+KDE, you can use khtml2png. I've tried the former and it works quite well, and heard of the latter being put to use.

我最近遇到了

I recently came across QtWebKit which claims to be cross platform (Qt rolled WebKit into their library, I guess). But I've never tried it, so I can't tell you much more.

QtWebKit链接显示了如何从Python访问.您应该至少能够使用子进程与其他子进程进行相同的操作.

The QtWebKit links shows how to access from Python. You should be able to at least use subprocess to do the same with the others.

这篇关于如何使用Python拍摄网站的屏幕截图/图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆