Samples‎ > ‎Image‎ > ‎

Capture Full Screen

package jxcapture.image;

import com.teamdev.jxcapture.CompressionQuality;
import com.teamdev.jxcapture.ImageCapture;
import com.teamdev.jxcapture.image.ImageFormat;
import com.teamdev.jxcapture.video.FullScreen;

import java.io.File;

/**
 * The example demonstrates full screen capturing.
 * <pre>
 * Platforms:           All
 * Image source:        FullScreen
 * Output image format: JPEG
 * Output file:         FullScreen.jpg
 *
 * @author Serge Piletsky
 * @author Ikryanov Vladimir
 */
public class CaptureFullScreen {
    public static void main(String[] args) throws Exception {
        ImageCapture imageCapture = ImageCapture.create(new FullScreen());
        long before = System.currentTimeMillis();
        imageCapture.takeSnapshot().save(new File("FullScreen.jpg"), ImageFormat.JPEG, CompressionQuality.HIGH);
        long after = System.currentTimeMillis();
        imageCapture.release();
        System.out.println("Operation took " + (after - before) + " milliseconds.");
    }
}