Convert web page to image [closed]

2019-01-01 12:26发布

What are some utilities to obtain an image of a webpage?

Basically equivalent to taking a "screenshot" of the page after opening it.

10条回答
萌妹纸的霸气范
2楼-- · 2019-01-01 12:31

I'm not sure if this is quite what you're looking for but I've had a lot of success using an HTML to Postscript converter html2ps to create postscript copies of web pages, which I then convert to .gif or .pngs

This doesn't produce exact screenshot quality that you'd get from a web browser and doesn't handle complicated things like flash or css all that well, but the advantage is that you can run it on the web server.

(I use it to create thumbnails of user created content, for navigation)

查看更多
低头抚发
3楼-- · 2019-01-01 12:33

Somebody wrote a blog post about this a few years back. There are examples in several languages, using both WebKit and Mozilla. There's also an example in Ruby.

It boils down to this: decide how wide you want your window to be; put a browser component in the window; wait until the page loads; capture the pixel buffer contents.

查看更多
谁念西风独自凉
4楼-- · 2019-01-01 12:37

http://code.google.com/p/wkhtmltopdf/ again..

Somebody mentioned this already.. I will write about it in more detail...

Contrary to what the name implies, there is html page to image converter as well.
It supports png and jpeg.
One can modify the user agent string of all requested urls and minimum width and height of the webpage.
It is possible to add new headers and set it for all requests.
It works on Windows and Linux.
It can ignore webpage errors.
It uses Webkit and Qt library. It installs easily, no additional libaries are needed
(everything is included in the distribution).
It is free and regularly updated. There are binaries available for both Linux and Windows.
It can handle flash on Windows. (It may do so on Linux as well, untested)

查看更多
美炸的是我
5楼-- · 2019-01-01 12:38

You can also use "gnome-web-photo" as a command line tool to screenshot a webpage.

查看更多
回忆,回不去的记忆
6楼-- · 2019-01-01 12:39

Using Firefox, you will need the screengrab addon.

查看更多
琉璃瓶的回忆
7楼-- · 2019-01-01 12:43

You could use imagemagick and write a script that fires everytime you load a webpage.

查看更多
登录 后发表回答