I need to get fullscreen shot of website by URL, is there any PHP programs for that or services, if not, is there any Java programs for that purpose?
8 Answers
There are plenty of ways:
Use webkit engine with some bindings for it: http://www.blogs.uni-osnabrueck.de/rotapken/2008/12/03/create-screenshots-of-a-web-page-using-python-and-qtwebkit/
Use mozilla engine in batch mode: http://www.chimeric.de/blog/2007/1018_automated_screenshots_using_bash_firefox_and_imagemagick

- 1,420
- 2
- 8
- 5
-
wow, #2 is awesome! Going to have to remember that for the future. – snicker Sep 28 '09 at 18:51
You need to have a special version of a browser to "render" the page after it's processed by PHP or Java.
You'll most-likely need to set up some custom automation scripts to hit a URL after you ping a server running windows, OSX or a Linux window manager.
There are services out there which will do screen shots for you.
http://webthumb.bluga.net/home
to name a few.

- 7,432
- 4
- 26
- 28
The best solution for me: Use selenium webdriver And taking screenshot can be as simple as this:
import java.io.File;
import java.net.URL;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.Augmenter;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class Testing {
public void myTest() throws Exception {
WebDriver driver = new RemoteWebDriver(
new URL("http://localhost:4444/wd/hub"),
DesiredCapabilities.firefox());
driver.get("http://www.google.com");
// RemoteWebDriver does not implement the TakesScreenshot class
// if the driver does have the Capabilities to take a screenshot
// then Augmenter will add the TakesScreenshot methods to the instance
WebDriver augmentedDriver = new Augmenter().augment(driver);
File screenshot = ((TakesScreenshot)augmentedDriver).
getScreenshotAs(OutputType.FILE);
}
}
Dont forget to use FireFoxDriver. HtmlUnitDriver wont work this way as its headless.
Darn easy!!

- 10,411
- 24
- 90
- 164
-
But you need Selenium server running and firefox browser installed for this to work? – newbie Jun 29 '14 at 12:02
-
@newbie Firefox browser installed required.But no need for Selenium server running. You just need to import the needed libraries to your java project. – rahulserver Jun 29 '14 at 15:44
Litmus is a great online resource for this kind of thing; you can submit a URL and have it take full-page screenshots on the latest browsers. If you get a paid subscription or use it on weekends, you'll have access to test on all 22 of its browsers instead of just the most recent. I use this website all the time, I think it's phenomenal.
BrowserShots is also great, and it supports tons more browsers, but in my experience it's a lot slower too. It's good to use if you need to test some browser Litmus doesn't, though.

- 2,762
- 1
- 17
- 17
-
I didn't mean that I need to test webpages on different browsers, but rather I need to get screenshots fast from given urls. Is there any open source/free application for that, it really doesn'y have to be php or java, just free software that works... – newbie Sep 28 '09 at 18:36
-
I guess I'm not understanding the difference. You could still use Litmus or Browsershots for that same thing, just run the test for one browser. – Twisol Sep 28 '09 at 18:40
I found out that CutyCapt is the most easiest solution to take screenshots and it will work in Windows and Linux.
Installinging in Windows:
Just download file and execute.
Installining in debian:
apt-get install cutycapt xvfb
and running:
xvfb-run --server-args="-screen 0, 1024x768x24" /usr/bin/cutycapt --url=http://www.google.com --out=/home/screenshots/screenshot_name.png

- 24,286
- 80
- 201
- 301
You can also do it yourself if you had a dedicated server. The idea is to launch a X Server and a browser in fullscreen mode, to take a shot, and save it into an image file.
Depending of your utilisation (occasional or intensive), you can adapt the process (i.e. not killing X everytime, etc...) to make it faster.

- 149
- 4
It's not clear from the question whether you're looking to do this programatically or manually. If manually: there is a great plug-in for Firefox called Abduction! that renders a page as an image. Otherwise, Kane's answers have it pretty much covered.

- 5,512
- 10
- 41
- 45
Try a headless browser. Any one of these should do it:
- PhantomJS -> uses 'Webkit' layout engine (Safari/Chromium)
- TrifleJS -> uses 'Trident' layout engine (Internet explorer)
- SlimerJS -> uses 'Gecko' layout engine (Firefox)
You can take a screenshot by using following javascript code (saved to file renderpage.js
):
var page = require('webpage').create();
page.open('http://en.wikipedia.org', function() {
page.render('wikipedia.png');
});
Then execute via command line:
> phantomjs.exe renderpage.js
This will create a file wikipedia.png
with your screenshot.

- 20,944
- 9
- 74
- 82