怎么将html转成图片

如何将html转成图片
如题,如何通过java来将html文件转成图片,
有没有开源的可以通过命令调用的软件,或者说一下实现思路!
请求大神来帮忙!
当前情况:不能使用javafx,html内部样式很多很乱。
------解决方案--------------------
http://wkhtmltopdf.org/
wkhtmltopdf and wkhtmltoimage are open source (LGPL) command line tools to render HTML into PDF and various image formats using the QT Webkit rendering engine. These run entirely "headless" and do not require a display or display service.
------解决方案--------------------
phantomjs,内置了浏览器内核,解析html转换成图片。
还不错,demo我已经做出来了,基本问题都可以解决,自己google下,很简单。
------解决方案--------------------
你这属于渲染dom和javascript,然后生成截图,楼上楼上说的phantomjs是一种,不过不太易用,可以用上层封装的casperjs,不过都是py写的,但也不耽误用。