[封坑完成] 如何在终端为网页截取一个完整长度的截图

This commit is contained in:
Wenxuan Zhao 2014-05-12 22:29:58 -03:00
parent b28f6f1302
commit e006ee9852

View File

@ -1,50 +1,54 @@
How to take full length screenshots of websites via terminal 如何在终端为网页截取一个完整长度的截图
================================================================================ ================================================================================
![](http://180016988.r.cdn77.net/wp-content/uploads/2014/04/Screenshot-790x526.png) ![](http://180016988.r.cdn77.net/wp-content/uploads/2014/04/Screenshot-790x526.png)
This is a guest post, written by **Tsamis Konstantinos**. He is an avid user of Linux and Open Source, and also a regular visitor of Unixmen. You can contact him via email: **tsamis73@gmail.com** 这是一个名叫 **Tsamis Konstantinos** 的访客所发的帖子。他是一个 Linux 和开源软件的狂热用户,也是一个 Unixmen 的常客。你可以通过他的邮箱 **tsamis73@gmail.com** 联系他:
Taking screenshots is something we all do to remember things instead of notes and for sending things we saw to others. But usually, if not always the webpage were taking screenshots of doesnt fit into our screen and so we need to take multiple screenshots to capture all of it. 除了记笔记以外我们经常用截图来帮我们记忆,或是将看到的一些东西发给别人。
但是通常情况下,如果一个网页超出了屏幕高度,我们就得用多张截图去截取其全部内容。
For Linux there is a GNOME application that can take any url you give it and return a full length screenshot of it. The application is called **gnome-web-photo** and in this article you can see how to install it and use it. 对于 Linux你将会有一个更好的解决方案使用一个 GNOME 的应用来截取某个链接的整个页面。
这个应用叫做 **gnome-web-photo**,而这篇文章将介绍如何按照和使用她。
To install gnome-web-photo on Ubuntu or Debian you type: 在 Ubuntu 和 Debian 的分支下:
$ sudo apt-get install gnome-web-photo $ sudo apt-get install gnome-web-photo
If you are using Fedora: 在 Fedora 下:
$ sudo yum install gnome-web-photo $ sudo yum install gnome-web-photo
If you are using CentOS or RedHat user, be aware that `gnome-web-photo` depends on GTK+ 3.0. This means that `gnome-web-photo` is not compatible with GNOME 2, which is shipped with CentOS/RHEL 6. 但是对于 CentOS 和其他 RedHat 分支的用户,请注意 `gnome-web-photo` 依赖 GTK+ 3.0 这个软件包。
也就是说 `gnome-web-photo` 是和 CentOS/RHEL 6 自带的 GNOME 2 不相兼容的。
To actually take a screenshot of a web page: 要为一个网页截图:
$ gnome-web-photo -t 0 --mode=photo http://www.unixmen.com output.png $ gnome-web-photo -t 0 --mode=photo http://www.unixmen.com output.png
The above command will take the full length screenshot of the Unixmen website, and save it in the current directory. 上面这条命令将为 Unixmen 的主页截取一个完整长度的截图,并保存在当前工作目录下。
Sample output: 输出样例:
![](http://180016988.r.cdn77.net/wp-content/uploads/2014/04/output2.png) ![](http://180016988.r.cdn77.net/wp-content/uploads/2014/04/output2.png)
The **-t** parameter specifies the timeout value (in seconds) for screenshot generation. **-t 0** means that timeout is disabled. **-t** 这个参数可以设置生成截图的超时时间。**-t 0** 则表示禁用超时参数。
**With** gnome-web-photo, you can also generate a small thumbnail of a webpage like this: Optionally, you can specify thumbnail size by using “**-s**” option. The default thumbnail size is **256×256**. **通过** gnome-web-photo你可以用下面的命令为一个网页生成一个缩略图默认大小是 **256×256**,但是可以通过 “**-s**” 来指定缩略图的大小)
$ gnome-web-photo -t 0 -s 128 --mode=thumbnail http://www.unixmen.com output.png $ gnome-web-photo -t 0 -s 128 --mode=thumbnail http://www.unixmen.com output.png
Sample output: 输出样例:
![](http://180016988.r.cdn77.net/wp-content/uploads/2014/04/output.png) ![](http://180016988.r.cdn77.net/wp-content/uploads/2014/04/output.png)
If you want to save a screenshot of a website as a multi-page PDF, so that you can print it out later, you can type: 如果你想将网页截取成一个可供打印的多页 PDF 文档,你可以输入下面的命令:
$ gnome-web-photo -t 0 --mode=print http://www.unixmen.com output.pdf $ gnome-web-photo -t 0 --mode=print http://www.unixmen.com output.pdf
Note that the application doesnt support the **.jpg** format. 注意这个应用并不兼容 **.jpg** 格式。
This application is quite useful for all sort of uses. Thumbnails and full length screenshots are useful to me and hopefully to you, too. 这个应用应该对各类用户都有所帮助。
我经常对网页进行缩略图和完整长度的截图,希望对你也有所帮助。
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------