抓取并制作网页缩略图

在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 - <[email protected]>

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 [email protected] (Donate via SourceForge)

你可能感兴趣的:(windows,PHP,webkit,cvs,qt)