Web Page Thumbnails

Matt Biddulph wrote a nice little hack to create a thumbnail of any URL using Mozilla and Python. In awe of the coolness this could give, I grabbed it and had a quick play. Matt and myself both spotted the deliberate error he introduced in the script he uploaded, then I replaced the usage of PIL with GDK (thus doing the rescale in memory without going to disk), and fiddle the size of the thumbnail. Et volia:

Thumbnail of burtonini.com

There are still issues: sadly Mozilla won't render the page to a window without the window being visible on screen. Maybe a lower-level API would allow this, but for now it does the the job rather well. Well done Matt. My hacked copy is available here.

NP: Liquid Swords, GZA.

14:09 Monday, 14 Jun 2004 [#] [computers] (20 comments)

Posted by Jodrell at Mon Jun 14 16:09:27 2004:
You might want to look at xvfb (the X Virtual Frame Buffer) for doing screenshots without a full X server.

http://www.xfree86.org/4.0.1/Xvfb.1.html
Posted by Ross at Tue Jun 15 09:48:30 2004:
A plan was to take thumbnails for Nautilus, so an X server would be running.  I just need a way of telling Mozilla to render to a unrealised window.
Posted by James at Wed Jun 16 07:35:47 2004:
Rendering to an unrealized window makes no sense.  In classic X, a window has no storage other the framebuffer, so when it is unrealized, there is nothing to draw onto.

If you were using Keith's X server, you could use the Composite extension to redirect the contents of the mozilla widget's window heirarchy.

I doubt you'd have much luck replacing the widget's window with a pixmap though this won't help if the widget makes use of subwindows.
Posted by Victor Hooi at Thu Jun 17 12:42:17 2004:
Hi,

Looks very cool. Eye-candish (is that a word?), but also possibly useful.

Any change of it making it into Nautilus 2.7 anytime soon?

Also, does anybody know how to re-enable the old style MIME sniffing in Nautilus 2.6 without a recompile.

Finally, any way to get text file preview in the icons in nautilus, like in KDE?

Thanks,
Victor
Posted by mat at Thu Jul 1 07:36:37 2004:
This option would be very welcome as a browser plugin for IE
Posted by Andrzej Bialecki at Tue Sep 14 21:47:57 2004:
Hi,

A big, big, THANK YOU! I was pulling my hair for two days and nights, without any luck, looking for a solution, when I found this page. Tremendously useful tool! I'm using it running headless (Xvfb), for pushing URL thumbnails to a J2ME application.

Thank you for making this available.

Andrzej
Posted by Dan Scott at Tue Jan 2 16:08:01 2007:
Hi,

Excellent work, thanks.

I had to make a couple of changes to get it working in Fedora.

yum install gnome-python2-gtkmozembed to get the GTK/Python/Moz stuff.

This installs the python module, but it's called "gtkmozembed", not "gtkmoz" so you need to replace this throughout the script.

Dan
Posted by Sjefke at Mon Jan 15 22:30:07 2007:
Hi Ross,

Found your site here: http://www.hackdiary.com/archives/000055.html,

which was linked to from here:

http://dev.upian.com/hotlinks/

I'm using Magpie now to display an Atom feed, but like Hotlink, would like to display a screenshot (Francois, of that site, doesn't seem to be in best mood replying to my request...).

Is there a package\one time install of your 'program'? I do know some coding, but installing server add ons etc is too much asked of me.
Or where I can a more detailed explanation - as I have to ask my host to set it up.

If not possible, are there any alternatives?

Battling now for days ;-(

Thanks in advance!
Posted by Sjefke at Mon Jan 15 22:58:55 2007:
Ross,

How\where did you get the required calculation script? It's really clever and much easier to implement than http://captchas.net/ (which is very good in itself).

Thanks!
Posted by Darren Chambers at Wed Jun 6 21:25:37 2007:
You could start another X display ' startx -- :1 ' and export your display there. It's not the best idea but you can still use your pc whilst it's working :)
Posted by Darren Chambers at Thu Jun 7 16:53:06 2007:
:( I'm using Fedora 7 & cannot get this to work for love nor money. The line self.parent.show_all() appears to cause a segmentation fault which is a shame as I think this is one of the coolest things I've seen on the web.
Posted by Eduardo Cardoso at Wed Jul 4 21:20:22 2007:
I managed to get this to work on Fedora Core 5, with the following steps found on this page and previous Google searchs:

- Replace references of "gtkmoz" with "gtkmozembed"
- Export LD_LIBRARY_PATH=/path/to/your/mozilla/installation
- Run the script

I had 3 versions of libgtkembedmoz.so:
- One that I compiled myself from the Firefox 2.0.0.4 source code and didn't seem to work
- One from Firefox 1.5.0.1 installed from yum repositories that failed in a point different from my compiled version
- The Mozilla 1.7.12, also from yum repositories, which worked perfectly.

I have no idea why such incompatibility between libraries (maybe I can understand mine, but what about both builds from repositories?), so if anyone has a clue, please post back.

I should try this soon on a Fedora Core 7 installation, and at my Ubuntu Feisty at home and see what happens. I'll report back any findings :-)
Posted by Steve Castellotti at Sun Jul 22 08:14:26 2007:
See the following link for getting this to work under Fedora 7, and likely Ubuntu as well

https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/26436/comments/47
Posted by Barry Cester at Wed Apr 2 05:16:54 2008:
Are people still doing screen capture / thumbnailing this way? I would like to try this, but how do I begin? Does anyone know of firefox add-ons that do this now?
Posted by Tobia Conforto at Mon Apr 21 16:04:01 2008:
I've built upon your idea, to create a commandline tool for automated / batch capturing of website thumbnails.

My main additions are the automatic launching of a VNC server, for headless / batch usage, and a guardian process to kill the main process after a timeout, so that the script won't wait forever in the case of network problems or other nuisances.

I have also written a helper script to call many instances of my main script in parallel, reusing the VNC servers, for maximum speed in thumbnail creation.

http://www.gruppo4.com/~tobia/pythumbnail.shtml
Posted by Ross at Mon Apr 21 16:27:53 2008:
Tobia: so you haven't seen gnome-web-thumbnail then?
Posted by bl8cki at Thu Jul 3 12:30:58 2008:
export MOZILLA_FIVE_HOME=/usr/lib/firefox-2.0.0.14
works for me

related link: https://bugs.launchpad.net/firefox/+bug/26436
Posted by bl8cki at Thu Jul 3 15:32:50 2008:
it works with Xvfb fine :
Xvfb :1 -ac
export DISPLAY=:1
python ...
Posted by xzhang at Thu Jul 24 03:28:25 2008:
Hi, I was very lucky to find this since I really need a tool to take snapshot of web pages.

It took me a whole night to get this running on my box and at last I have a problem:
How can I take a screen shot for the whole page but just the part displayed in window? (e.g. the page's height is 1200px but I open a window with size 800x600. then in the snapshot I only get half of the page)

thanks!
Posted by Declan at Sat May 9 14:06:52 2009:
Hi

This looks like a very useful for creating thumbnails but I was wondering if this would work with Flash enabled web sites? Shocwave-Flash version 9 or 10.

Any ideas?

Thanks
Declan

Name:


E-mail:


URL:


Add 9 and 9 (required):


Comment: