Command-line tool for creating screenshots of websites (on Linux)

What is a good command line tool for taking screenshots of websites on Linux? I need to automatically take screenshots of websites without human interaction. The only tool I found was khtml2png , but I wonder if there are others that are not based on khtml (i.e. have good JavaScript support, ...).

+62
linux screenshot
Sep 24 '08 at 8:03
source share
10 answers

A little more detail might be useful ...

Launch firefox (or another browser) in an X session, either on the console or using vncserver. You can use the --height and --width to set the window size in full screen. Another firefox command can be used to set the URL displayed in the first firefox window. Now you can capture the image using one of several commands, such as the "import" command from the Imagemagick package, or using gimp or fbgrab or xv.

 #!/bin/sh # start a server with a specific DISPLAY vncserver :11 -geometry 1024x768 # start firefox in this vnc session firefox --display :11 # read URLs from a data file in a loop count=1 while read url do # send URL to the firefox session firefox --display :11 $url # take a picture after waiting a bit for the load to finish sleep 5 import -window root image$count.jpg count=`expr $count + 1` done < url_list.txt # clean up when done vncserver -kill :11 
+54
Sep 27 '08 at 6:52
source share

Try a nice little CutyCapt tool that only depends on Qt and QtWebkit .;)

+37
Jul 12 '12 at 19:30
source share

Check out PhantomJS , which seems to be the free scritable Webkit engine that runs on Linux, OSX, and Windows. I have not used it since we currently use Browshot (a commercial solution), but when all our loans run out, we will have serious production (since then it’s free and can work on our servers)

+7
Jun 05 '13 at 13:25
source share

scrot is a command line tool for taking screenshots. See the man page and this tutorial .

You might also want to see the browser script. There are Firefox add-ons that take screenshots, such as screengrab (which can capture the entire page if you want, not just the visible bit) and you could take a screenshot of a browser script with greasemonkey .

+5
Oct 02 '08 at 20:57
source share

I know that this is not a command line tool, but you can easily use something script http://browsershots.org/ Not so useful for applications that are not hosted on external IP addresses.

Great tool nonetheless.

+2
Sep 24 '08 at 8:19
source share

See Webkit2png .

I think this is what I used in the past.

Change I found that I did not use the above, but found this page with reviews of many different programs and methods.

+2
Mar 27 '13 at 19:15
source share

I don’t know anything to order, I’m sure that something can be done with the gecko engine for rendering in a png file instead of a screen ...

Or you can start firefox in full screen mode in a dedicated instance of the VNC server and use a grabber screenshot to take a screenshot. Fullscreen = minimal chrome, VNC server instance = no visible interface + you can choose your resolution.

Use xinit with Xvnc as an X server to do this - you will need to read all the manpages.

The disadvantages are that the screenshot is always the same size, does not change according to the web page ...

+1
Sep 24 '08 at 8:20
source share

There is an import command, but you will need X and a little bash script that will open a browser window, then take a screenshot and close the browser.

You can find more information here or just type import --help in the shell;)

+1
Sep 24 '08 at 9:05
source share

http://khtml2png.sourceforge.net/

Deb file

worked on my Ubuntu after installing libkonq4 ... but you may have to cover other dependencies.

I think javascript support could be better!

Stephan

+1
Feb 04 2018-10-10T00
source share

Not for the command line, but at least for use in a batch operation for a larger set of URLs, you can use firefox with its addon fireshot (licensed version?).

  • Open the tabs for all the URLs in your set (for example, "open the tabs for all the bookmarks in this folder ...").
  • Then at the start of fireshot "Capture all tabs"
  • In the editing window, click "select all images β†’ save all images"

By setting the screenshot properties (size, file formats, etc.), before you finish with a good set of shots.

Steffen

+1
Feb 17 2018-12-12T00:
source share



All Articles