# Render html to pic

**URL:** <https://www.ruby-forum.com/t/render-html-to-pic/172713>\
**Category:** Rails\
**Created:** [July 26, 2009, 3:59pm UTC](https://www.ruby-forum.com/t/render-html-to-pic/172713 "2009-07-26T15:59:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blueomega](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e95f7d/32.png) [@blueomega](https://www.ruby-forum.com/u/blueomega)\
**Post date:** [July 26, 2009, 3:59pm UTC](https://www.ruby-forum.com/t/render-html-to-pic/172713/1 "2009-07-26T15:59:16Z")

</div>

So a need to do a complete print to an image of a website, server  
side, and doesn’t really matters the price (ok it matters, if its not  
to high :P). Runs a nix machine

So i found a a couple of options:

[Convert HTML To Image on Linux : JPG, JPEG, BMP, PNG with html2image for Linux](http://www.guangmingsoft.net/htmlsnapshot/html2image.htm) It has a ruby  
samples and it works perfectly(4 lines of code), but i can’t find the  
API and the available methods.

[Http://pearlcrescent.com/products/pagesaver/doc/#commandline](Http://pearlcrescent.com/products/pagesaver/doc/#commandline) Also  
works, uses firefox to render, but i don’t know how it will handle  
lots of multiple requests(performance wise), any idea?

[khtml2png download | SourceForge.net](http://khtml2png.sourceforge.net/index.php?page=about) similar to pearl  
crescebt, but for konqueror

with headless server  
[http://www.hackdiary.com/2004/06/13/taking-automated-webpage-screenshots-with-embedded-mozilla/](http://www.hackdiary.com/2004/06/13/taking-automated-webpage-screenshots-with-embedded-mozilla/)  
and  
[http://www.blogs.uni-osnabrueck.de/rotapken/2008/12/03/create-screenshots-of-a-web-page-using-python-and-qtwebkit/](http://www.blogs.uni-osnabrueck.de/rotapken/2008/12/03/create-screenshots-of-a-web-page-using-python-and-qtwebkit/)  
i need to use python ☹

[http://ruby-gnome2.sourceforge.jp/hiki.cgi?RubyGecko](http://ruby-gnome2.sourceforge.jp/hiki.cgi?RubyGecko) MozSnapshooter  
seems to work, didn’t have time to try it, any one used it?

seleniumhq ([http://seleniumhq.org/](http://seleniumhq.org/)) uses ruby and has an interface  
that can grab a screenshot. does any one know of samples with selenium  
(any example should do)?

Does any one know alternatives?  
Does any one used one of them?  
Performance wise, what should i use?

---

<div class="post-metadata">

**Author:** ![blueomega](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e95f7d/32.png) [@blueomega](https://www.ruby-forum.com/u/blueomega)\
**Post date:** [July 26, 2009, 6:10pm UTC](https://www.ruby-forum.com/t/render-html-to-pic/172713/2 "2009-07-26T18:10:22Z")

</div>

That’s an interesting problem. If you don’t mind me asking, why do you  
need  
to take screenshots of your websites?

---

<div class="post-metadata">

**Author:** ![blueomega](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e95f7d/32.png) [@blueomega](https://www.ruby-forum.com/u/blueomega)\
**Post date:** [July 26, 2009, 7:25pm UTC](https://www.ruby-forum.com/t/render-html-to-pic/172713/3 "2009-07-26T19:25:18Z")

</div>

During vacations i was invited to add features to a project (need  
money for erasmus :P), already in use in some schools(full district),  
for children between 6~10 years. The project is a page were student  
can do or submit assignments(painting, writing), share information,  
etc, with some social networking. It is also menth to support parents,  
teachers and school management. this at a basic level.

as i said i was invited to work on it, and do some research and  
wrought features (interface doesn’t really matter, just the logic).

like i said, they can do projects on it, and i need to get a thumbnail  
of it (might be text, might be a picture, might be anything else,  
there are planed more stuff).

the page has areas were project can be exposed\promoted(for the class,  
school, district), that’s were the image generator really matters, i  
need thumbnails of the image generated

So i need to create a preview of every new project or change in  
project, right after i save it. i dont need the complete page (i will  
crop the page borders), but i need the complete project (or the head  
of it)
