navigate to webpage and capture whole screen to a JPEG?

F

Flip

Is it possible to navigate to a URL, take a "screenshot" of the webpage and
save it to a JPEG? I would like to create a dynamic screensaver which would
show me the latest CSI webpage on my monitor. Is something like this
possible? I figure I can create the URL, goto the webpage, and I can learn
how to steam a JPEG to a file, and even draw it to a panel, but I don't know
how to screen scrape the webpage's screen.

Thanks.
 
J

John Davison

Flip said:
Is it possible to navigate to a URL, take a "screenshot" of the webpage and
save it to a JPEG? I would like to create a dynamic screensaver which would
show me the latest CSI webpage on my monitor. Is something like this
possible? I figure I can create the URL, goto the webpage, and I can learn
how to steam a JPEG to a file, and even draw it to a panel, but I don't know
how to screen scrape the webpage's screen.

Thanks.

http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Robot.html#createScreenCapture(java.awt.Rectangle)

Then you could use ImageIO to save it to a JPEG, although you wouldn't
need to do that if you're just going to paint it to a panel.

However, it seems like javascript would be better suited for this task.

- john
 
S

Shanmuhanathan T

Is it possible to navigate to a URL, take a "screenshot" of the webpage and
save it to a JPEG? I would like to create a dynamic screensaver which would
show me the latest CSI webpage on my monitor. Is something like this
possible? I figure I can create the URL, goto the webpage, and I can learn
how to steam a JPEG to a file, and even draw it to a panel, but I don't know
how to screen scrape the webpage's screen.

Thanks.
<OT>
If you are using a windows PC, you can try setting a url
as a webpage on you active desktop and refresh it periodically.

</OT>
Regards
 
A

Andrew Thompson

Is it possible to navigate to a URL, take a "screenshot" of the webpage and
save it to a JPEG? I would like to create a dynamic screensaver

If you want to make screensavers, you should look into
the SaverBeans API at JDIC <https://screensavers.dev.java.net/>

Examples of some of the savers here*, including my
two thus far, StarZoom and HumanRights.
* <http://www.physci.org/saver/>

A (perhaps) relevant URL ..Robot.createScreenCapture()
...which would
show me the latest CSI webpage on my monitor.

(chuckles) How's it go in a JEditorPane?

HTH

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
 
T

Thomas Fritsch

Flip said:
Is it possible to navigate to a URL, take a "screenshot" of the webpage and
save it to a JPEG? I would like to create a dynamic screensaver which would
show me the latest CSI webpage on my monitor. Is something like this
possible? I figure I can create the URL, goto the webpage, and I can learn
how to steam a JPEG to a file, and even draw it to a panel, but I don't know
how to screen scrape the webpage's screen.

Thanks.

Have a look at
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Robot.html#createScreenCapture(java.awt.Rectangle)
http://java.sun.com/j2se/1.3/docs/guide/2d/api-jpeg/com/sun/image/codec/jpeg/package-summary.html

May be these things will suffice.
 
F

Flip

Howdy.
If you want to make screensavers, you should look into
the SaverBeans API at JDIC <https://screensavers.dev.java.net/>
Yup, already there! :> haha Thanks.
A (perhaps) relevant URL ..Robot.createScreenCapture()
<https://screensavers.dev.java.net/servlets/ProjectForumMessageView?messageI
D=3136&forumID=698>
Cool! Thank you.
(chuckles) How's it go in a JEditorPane?
Are you chuckling at the CSI reference? :> Ya, I know, dumb, but anything
to keep the excitement high! :>
 
A

Andrew Thompson

I would like to create a dynamic screensaver which would
show me the latest CSI webpage
This?

..on my monitor.

If that's the page, Robot screencapture and
the JEditorPane* are probably out of the question..

*
<sscce>
import javax.swing.*;
import java.net.URL;
import java.io.IOException;

/** Display CSI web page. */
class Browser extends JFrame {

public Browser(URL url) throws IOException {
super("Adding HTML to a JEditorPane");

getContentPane().add( new JEditorPane(url) );

setDefaultCloseOperation(
WindowConstants.DISPOSE_ON_CLOSE);
pack();
validate();

}

/** Instantiate this class. */
public static void main(String[] args) throws Exception {
URL url =
new URL("http://www.cbs.com/primetime/csi/main.shtml");
Browser b = new Browser(url);
b.setVisible(true);
}
}
</sscce>

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
 
F

Flip

(An URL speaks a thousand words, Flip)
Sorry about that. I'm used to people saying "we won't do your work", so I
left out some details, only describing high level objectives thinking I
would be able to try it out later on.
If that's the page, Robot screencapture and
the JEditorPane* are probably out of the question..
Thank you for the code, more than I could ask for! I just tried it out and
I see what you're saying about it not working. :< There are too many client
side things going on there. :< Is there a browser type java object that can
be used instead?
 
A

Andrew Thompson

There are too many client
side things going on there. :< Is there a browser type java object that can
be used instead?

I've been wonderring how to work it myself, Flip.
(And, ..yes, it was exactly for a 'MyFaves' type web-page saver)

BrowserLauncher, which is an open source code, can
grab the User's own browser and open it with a URL,
but it will not do the other (3) things required for
this (very bizarre) application.

1) Send the browser to full-screen (preferably 'chromeless')
2) change pages once opened.

So, ..not that I know of. :-(

I would love to hear any ideas though.

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
 
A

Andrew Thompson

(...'MyFaves' type web-page saver)

BrowserLauncher, which is an open source code, can
grab the User's own browser and open it with a URL,
but it will not do the other (3) things required for
this (very bizarre) application.

1) Send the browser to full-screen (preferably 'chromeless')
2) change pages once opened.

....er and, ummm.. oh yeah!
3) Make the web-page act in a sensible way.

I have another Win specific exe that makes URL based savers,
but they are a bit quirky. If you click on a link, the
browser attempts to open the URL, while the saver manager
software is closing the browser!

It occured to me you might disable the links in the page,
or attempt to bring the browser back from 'full-screen,
chromeless' to a normal browser window, and continue
displaying the requested page.

...and, the more I think about it, this may actually be
workable using a page with an <iframe> elament, a bit of
clever script, ..and possibly lowering the UA security
settings for that page. (wanders off, muttering..)

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top