基于mozilla gecko内核可以让应用程序直接调用gecko的html renderer功能可以生成页面的thumbnai。目前基于firefox这样的开源浏览器相关技术(主要是gecko内核,其他内核暂时不考虑)的HTML Renderer方案大致可以分成如下几种:
- 采用firefox extension方式,然后通过提供命令行接口,例如page saver
- 采用xvfb+firefox或vnc+firefox,利用命令行调用xvfb或vnc调用firefox形成的图形缓冲区,然后用ImageMagick生成thumbnail
- 采用直接调用gecko 接口或封装接口来生成thumnail
从性能及扩展性上来讲,第三种方式最为理想,收集了一些基于Java或Python的HTML Renderer
1、Java
webrenderer(收费)
其他收费软件,可以参考
Java Sketchbook: The HTML Renderer Shootout, Part 2
2、Python+GTK
3、Ruby+GTK
实际上也是利用了GtkMozEmbed
http://oltsm.blogspot.com/2007/07/ruby-website-screencapture-howto.html
参考资料
http://blogs.pathf.com/agileajax/2007/01/how_to_really_d.html
http://today.java.net/pub/a/today/2004/05/24/html-pt1.html
http://java.net/pub/a/today/2004/06/14/html-pt2.html
http://www.hackdiary.com/archives/000055.html
http://oltsm.blogspot.com/2007/07/ruby-website-screencapture-howto.html
http://weblogs.mozillazine.org/roc/archives/2005/05/rendering_web_p.html
http://mail.python.org/pipermail/python-list/2006-December/419414.html
http://blog.pixnet.net/kewang/post/4756715
https://aptframework.dev.java.net/gooey/screenCapture.html
http://forum.java.sun.com/thread.jspa?threadID=5191504&tstart=75
http://schmidt.devlib.org/java/save-screenshot.html
http://forum.java.sun.com/thread.jspa?threadID=477654&messageID=2220990
http://forum.java.sun.com/thread.jspa?threadID=604040
http://ilovelate.blog.163.com/blog/static/601420074610168616/
http://zh.wikipedia.org/wiki/Trident