

import java.awt.Dimension;
import java.awt.image.BufferedImage;

import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamResolution;


public class CustomResolutionExample {

	public static void main(String[] args) {

		/**
		 * When you set custom resolutions you have to be sure that your webcam
		 * device will handle them!
		 */

		//@formatter:off
		Dimension[] nonStandardResolutions = new Dimension[] {
			WebcamResolution.PAL.getSize(),
			WebcamResolution.HD720.getSize(),
			new Dimension(2000, 1000),
			new Dimension(1000, 500),
		};
		//@formatter:on

		Webcam webcam = Webcam.getDefault();
		webcam.setCustomViewSizes(nonStandardResolutions);
		webcam.open();

		BufferedImage image = webcam.getImage();

		System.out.println(image.getWidth() + "x" + image.getHeight());
	}

}

@@ -1,17 +1,16 @@
-%0A
 %0Aimport java.awt
@@ -582,16 +582,73 @@
 ter:on%0A%0A
+%09%09// your camera have to support HD720p to run this code%0A
 %09%09Webcam
@@ -731,16 +731,72 @@
 tions);%0A
+%09%09webcam.setViewSize(WebcamResolution.HD720.getSize());%0A
 %09%09webcam

Update CustomResolutionExample.java