Get Screens can be used to capture screen shots of entire desktop or specified regions of the desktop. These screen shots can be saved in JPG/PNG formats. Another functionality of Get Screens is to create videos out of JPG files.
This can be downloaed from https://sourceforge.net/projects/getscreens/
As of now, Quicktime, MPEG, AVI are supported.
Get Screens uses JMF 2.1.1e [Java Media Framework] for movie generation. As entire code is written in Java, Get Screens can work on all platforms. JMF can be downloaded from http://www.oracle.com/technetwork/java/javase/download-142937.html
Feel free to send feedback to me at bssarath AT yahoo DOT co DOT in
Installation of JMF:
You can find more information at JMF at http://www.oracle.com/technetwork/java/javase/tech/index-jsp-140239.html .
To use Get Screens, it is enough that the jars[jmf.jar] of JMF are in the JAVA classpath.
Usage :
Mainly there are two utility classes.
1] CaptureScreen
2] MovieMaker
getscreens-0.1.jar needs to be in the CLASSPATH, to access the utility classes.
CaptureScreen:
-------------
As the name suggests, this class allows you to capture screen shots of the Desktop programatically.
Sample Code:
-----------
import java.awt.AWTException;
import java.io.File;
import java.io.IOException;
import com.sirisoft.image.Constants;
import com.sirisoft.image.CaptureScreen;
public class CaptureTest {
public static void main(String[] args) throws AWTException {
String fileFormat = Constants.JPG;
File outDir = new File("/tmp/images");
outDir.mkdirs();
CaptureScreen cs = new CaptureScreen(fileFormat, outDir, 1);
try {
for(int i = 0; i < 10; i++){
System.out.println("########Start");
cs.capture("cs" + i);
System.out.println("########Stop");
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
Copy paste this code into CaptureTest.java,
Change the output directory appropriately,
Save and run the below commands in the command prompt.
javac -cp getscreens-0.1.jar CaptureTest.java
java -cp getscreens-0.1.jar CaptureTest
Then you will see some images created in the output directory with names cs1.jpg, cs2.jpg ...
MovieMaker:
----------
This class is used to create movie files from JPG files.
Sample Code:
-----------
import java.io.File;
import com.sirisoft.image.MovieMaker;
import com.sirisoft.image.Constants;
public class MovieTest {
public static void main(String[] args) {
File ipDir = new File("/tmp/images/");
MovieMaker movieMaker = new MovieMaker(ipDir, Constants.JPG);
movieMaker.generateQuickTimeMovie(1280, 800, 1, "/tmp/b.mov");
//movieMaker.generateMPEGMovie(1280, 800, 1, "/tmp/b.mov");
//movieMaker.generateAVIMovie(1280, 800, 1, "/tmp/b.avi");
}
}
Copy this code into MovieTest.java,
Change the input and output directories appropriately,
Change the image width, height appropriately,
and run the following commands.
javac -cp jmf.jar:getscreens-0.1.jar MovieTest.java
java -cp jmf.jar:getscreens-0.1.jar MovieTest
If everything worked fine, you should be able to see a .mov file in the output directory. Play it in your favourite video player.
Read the API documentation for more convenience methods for invoking these two utility classes.
Tuesday, February 15, 2011
Subscribe to:
Comments (Atom)