Skip to main content

Resize and crop

Products: Video Capture SDK .Net

Video Capture SDK .Net can resize or crop video from any source. The code sample shows you how to do it.

Sample code - video resize

Enable resizing or cropping.

VideoCapture1.Video_ResizeOrCrop_Enabled = true;

Set width and height, and enable letterbox.

VideoCapture1.Video_Resize = new VideoResizeSettings
{
Width = 640,
Height = 480,
LetterBox = true
};

Select one of several resizing algorithms.

switch (cbResizeMode.SelectedIndex)
{
case 0: VideoCapture1.Video_Resize.Mode = VideoResizeMode.NearestNeighbor;
break;
case 1: VideoCapture1.Video_Resize.Mode = VideoResizeMode.Bilinear;
break;
case 2: VideoCapture1.Video_Resize.Mode = VideoResizeMode.Bicubic;
break;
case 3: VideoCapture1.Video_Resize.Mode = VideoResizeMode.Lancroz;
break;
}

Sample code - video crop

Enable resizing/cropping.

VideoCapture1.Video_ResizeOrCrop_Enabled = true;

Set region.

VideoCapture1.Video_Crop = new VideoCropSettings(40, 0, 40, 0);

Required redists

  • Video capture redist x86 x64

Visit our GitHub page to get more code samples.