抓取并制作网页缩略图

在windows环境下,可以考虑这个工具软件来抓页面截图:
IECapt.exe
在linux环境下,可以考虑这个工具软件来抓页面截图:
HTML2Image
获得抓取工具之后,就可以采用任何一种服务器语言编写程序,调用这个抓取工具,然后把抓取结果返回给用户。
下面是利用IECapt.exe并结合PHP抓取网站截图的例子。
在Windows/Apache2.2/Php5.2.5 下运行通过。

参考资料:
1.http://www.zubrag.com/scripts/website-thumbnail-generator.php
2.http://www.guangmingsoft.net/htmlsnapshot/html2image.htm

 

IECapt

IECapt is a small command-line utility to capture Internet Explorer's rendering of a web page into a BMP, JPEG or PNG image file. The C++ version also has experimental support for Enhanced Metafile vector graphic output. IECapt is available in a C++ and a C# version.

See CutyCapt for a Qt and WebKit (Safari) based cross-platform alternative to IECapt.

Samples

Here are some samples of IECapt generated renderings:

Status

"Works for me" :-) The current version is not very verbose, it does not catch or report errors, it has some general limitations and there are some known bugs to be addressed in future versions.

Requirements

IECapt depends on GDI+. GDI+ is included in Windows XP/2003/Vista/2008. If there is no gdiplus.dll on your system, you can download it from Microsoft and put it into the same directory where IECapt.exe resides.

Download

IECapt-2008-06-10.zip (2008-06-10, 54 KB)

IECapt-2008-04-27.zip (2008-04-27, 51 KB)

IECapt-2006-11-06.zip (2006-11-06, 52 KB)

Source code

The source code is available in the CVS repositorty.

Usage

Open a command prompt and ask for help:

C:\> IECapt --help
 -----------------------------------------------------------------------------
 Usage: IECapt --url=http://www.example.org/ --out=localfile.png
 -----------------------------------------------------------------------------
  --help                      Print this help page and exit
  --url=<url>                 The URL to capture (http:...|file:...|...)
  --out=<path>                The target file (.png|bmp|jpeg|emf|...)
  --min-width=<int>           Minimal width for the image (default: 800)
  --max-wait=<ms>             Don't wait more than (default: 90000, inf: 0)
  --delay=<ms>                Wait after loading (e.g. for Flash; default: 0)
  --silent                    Whether to surpress some dialogs
 -----------------------------------------------------------------------------
 http://iecapt.sf.net - (c) 2003-2008 Bjoern Hoehrmann - <bjoern@hoehrmann.de>

IECapt#

IECapt# is a new and experimental version of IECapt written in C#. The source code is available in the CVS repositorty: IECapt.cs and IECaptComImports.idl. Feedback and patches welcome. To build it, use:

  1. midl IECaptComImports.idl
  2. tlbimp IECaptComImports.tlb
  3. aximp %SystemRoot%\system32\shdocvw.dll
  4. csc /r:IECaptComImports.dll /r:AxSHDocVw.dll /r:System.Windows.Forms.dll /r:System.Drawing.dll IECapt.cs

Author

Björn Höhrmann bjoern@hoehrmann.de (Donate via SourceForge)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值