We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › screenshot website external tool HELP
Pages: 1 2 
screenshot website external tool HELP (Read 2879 times)
screenshot website external tool HELP
Jan 20th, 2010, 6:35am
 
How can I get a screenshot (a thumbnail) of a Website inside Processing?

Is Processing able to get one?
If not, what kind of external tool can you recommend?

THANKS for all IDEAS !


Re: screenshot website external tool HELP
Reply #1 - Jan 21st, 2010, 10:56am
 
I mean really just a thumbnail of the website.
No interaction with this site (no browser...).

Re: screenshot website external tool HELP
Reply #2 - Feb 2nd, 2010, 8:01am
 
i am also trying to do this, but couldn't figure out a way yet.

i don't think there is a way to get website thumbnails without some kind of browser-thing going on, because the html code has to be interpreted to produce a graphic result, but who knows.

i found a java plugin called jdic (http://www.processingblogs.org/2007/08/30/jdic-embedding-a-web-browser-in-java/) that works as a browser and you can  run it with processing. it is able to display pretty much every webpage. but it kinda works like a stand-alone app in its own extra window and i haven't figured out how you can send back data (i.e. screenshot) from the java-browser to processing.
i recently startet a thread for this (http://processing.org/discourse/yabb2/num_1264609096_.html

maybe you find jdic useful or have come up with an idea yourself in the meanwhile


Re: screenshot website external tool HELP
Reply #3 - Feb 2nd, 2010, 9:58am
 
I suspect it's the sort of thing that might already exist in PHP, so if you want to run this online then that might be your best option: generate the image with PHP then load it into Processing...
Re: screenshot website external tool HELP
Reply #4 - Feb 4th, 2010, 8:38pm
 
Perhaps you could use a service to generate the thumbnails? Just an example, but shrinktheweb has plugins for thumbnail generation on  different web platforms. Not sure if you can integrate that with Processing.
Re: screenshot website external tool HELP
Reply #5 - Feb 5th, 2010, 2:39am
 
The Java 2D - get an off-screen thumbnail from a webpage thread is a bit old but shows it is a common request... and there isn't (well, wasn't) satisfying solution to this hard problem (you need a real browser engine to properly render a complex modern Web page).
Re: screenshot website external tool HELP
Reply #6 - Feb 6th, 2010, 11:24am
 
In this old thread I found at the end a java library called "Scrender" that performs screen capturing of web sites.

But I could not find the reference - nowhere. . .
Re: screenshot website external tool HELP
Reply #7 - Feb 6th, 2010, 1:55pm
 
you could use the thumbalizr API to generate the images.
http://www.thumbalizr.com/apitools.php

should work.
Re: screenshot website external tool HELP
Reply #8 - Feb 6th, 2010, 2:00pm
 
yes it works... you get a screenshot of the website as image
mine : http://api.thumbalizr.com/?url=http://www.dec32.de&width=250

only problem to solve. it takes a while and it returns an "picture queued" image as long as the original shot is not loaded.
I would check for a special pixel color in this queded image, so you can make your own "waiting" screen as long as the image is not loaded.
other thing is the watermark, but this could be easily removed, by not drawing the latest 15 pixel of the image.
Re: screenshot website external tool HELP
Reply #9 - Feb 7th, 2010, 6:22am
 
The The Flying Saucer Project looks promising. But it renders only XML+CSS, no real HTML pages, with all their quirks and errors...
But they mention the excellent TagSoup library which is able to transform such poor HTML to XML.
Quite some work but can be a road to explore.
Re: screenshot website external tool HELP
Reply #10 - Feb 7th, 2010, 5:06pm
 
I found a command line tool, here:
http://www.paulhammond.org/webkit2png/

It is written in Python.
Could somebody explain how it works?
On the site he says: "Download webkit2png" - but theres nothing to download, just a text.
So I guess I have to do a copy/print and save it as ".py".
But where should I put this file so that the shell can find it ?
Re: screenshot website external tool HELP
Reply #11 - Feb 8th, 2010, 2:11am
 
Looks to be Mac only... Sad
I dislike these pages where the links are hidden (same style as text unless hovered), it is user-unfriendly.
But well, the source code is on GitHub, as said on the last line.

I am not a specialist of Mac, but you can put the script anywhere, as long as you provide its full path on the command line.

Using a non-Java utility is a good idea, a quick search shown NirSoft's SiteShoter for Windows (using IE), for example.
Re: screenshot website external tool HELP
Reply #12 - Feb 8th, 2010, 6:44am
 
PhiLho, I think the JDIC Library should work for you.
It uses InternetExplorer as engine. Have you tried it?
http://workshop.evolutionzone.com/2007/08/30/jdic-embedding-a-web-browser-in-java/#more-127
Re: screenshot website external tool HELP
Reply #13 - Feb 8th, 2010, 7:54am
 
Well, Flancke, it is your need, not mine... Smiley
And monsieurBlutbad mentioned Jdic already, telling he cannot get it to export bitmap data. If you used it successfully for this task, we would be interested if you shared your findings.
Re: screenshot website external tool HELP
Reply #14 - Feb 8th, 2010, 2:18pm
 
Ok. Alors, I thought JDIC is only for Windows, but no.
But the problem is the engine, that it uses:
For Windows it is Internet Explorer.
For Mac it is only Mozilla - not Firefox. (?) It is not the same thing.
Mozilla is a Browser that exists before Firefox. But they didn't developped it further. So now I'm trying to download an old version of this old Mozilla-Thing. For all Windows-users, could you tell me if it works with InternetExplorer?
I tried it with InternetExplorer for Mac, but it didn't work! Pffffou...

Check this code:
------------------------------------

// JDIC_multiple.pde  

// Marius Watz - http://workshop.evolutionzone.com  



import java.awt.*;  

import java.awt.event.*;  

import javax.swing.*;  



import java.net.URL;  

import java.net.MalformedURLException;  

import org.jdesktop.jdic.browser.*;  



aBrowser browser[];  

long last;  



void setup() {  

 size(800,600);  

 frame.setLayout(new GridLayout(2,2));  



 browser=new aBrowser[4];  

 for(int i=0; i<4; i++) {  

   browser[i]=new aBrowser();  

   browser[i].initPanel(400,300);  



   if(i==0) browser[i].setURL("http://www.google.com/");  

   if(i==1) browser[i].setURL("http://processing.org/");  

   if(i==2) browser[i].setURL("http://ffffound.com/");  

   if(i==3) browser[i].setURL("http://sojamo.tumblr.com/");  



   frame.add(browser[i].panel);  

 }  

}  



void draw() {  



}  



public class aBrowser {  

 Panel panel;  

 WebBrowser webBrowser;  



 public aBrowser() {  
   
   

       
       



   // Set engine to IE  or Mozilla

   BrowserEngineManager mng=BrowserEngineManager.instance();  

   mng.setActiveEngine(BrowserEngineManager.MOZILLA);
 
   IBrowserEngine be=mng.getActiveEngine();
   
   //the path that constains xpcom.dll
   //I think when you use IE as browser, you don't have to tell the Path...
   be.setEnginePath("d:\\mozilla\\bin\\mozilla.exe");  

   webBrowser = new WebBrowser();  

 }  



 public void initPanel(int w,int h) {  

   panel = new Panel();  

   panel.setLayout(new BorderLayout());  

   panel.setSize(w,h);  

   webBrowser.setSize(w, h);  

   panel.add(webBrowser, BorderLayout.CENTER);  

 }  



 public void setContent(String htmlContent) {  

   webBrowser.setContent(htmlContent);  

 }  



 public void setURL(String url) {  

   try {  

     webBrowser.setURL(new URL(url));  

     webBrowser.setDebug(false);  

   }  

   catch (MalformedURLException e) {  

     System.out.println(e.getMessage());  

     return;  

   }  

 }  

}

-----------------------------------
Pages: 1 2