Saves a snapshot from the running stream to a file as a bitmap.
public virtual void SaveStillBitmap(string fileName,StillFormatType format,int quality,int flags,int timeOut)
Public Overridable Sub SaveStillBitmap( _ByVal fileName As String, _ByVal format As StillFormatType, _ByVal quality As Integer, _ByVal flags As Integer, _ByVal timeOut As Integer _)
public:virtual void SaveStillBitmap(String^ fileName,StillFormatType format,int quality,int flags,int timeOut)
fileName
A string containing the name of the file in which to save the bitmap.
format
A StillFormatType value that represents the output file format.
quality
Value that represents the compression quality. For a list of possible values, refer to Compression Quality Factors. If and only if the StillFormatType parameter is equal to StillFormatType.CMP, you can use the StillQuality enumeration values.
flags
Reserved for future use. Pass 0.
timeOut
The timeout period in milliseconds. The method will fail if it was not able to take a sample in the specified time. Use -1 to wait indefinitely until a sample is snapped.
Saves a snapshot from the running stream to a file as a bitmap. This method blocks (does not return) until either the timeout occurs or the sample is snapped. The following methods can also be used to obtain still images:
using Leadtools;using Leadtools.Multimedia;using LeadtoolsMultimediaExamples.Fixtures;public CaptureCtrlForm _form = new CaptureCtrlForm();public CaptureCtrl _capturectrl = null;public bool _result = false;public void SaveStillBitmapExample(){// reference the capture control_capturectrl = _form.CaptureCtrl;// output filestring jpgFile = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_SaveStillBitmap.jpg");try{// select a video capture deviceif (_capturectrl.VideoDevices["USB"] == null)throw new Exception("No USB video device available");_capturectrl.VideoDevices["USB"].Selected = true;// set a video compressor for the capture file_capturectrl.VideoCompressors.Mpeg4.Selected = true;// start the capture_capturectrl.StartCapture(CaptureMode.Still);// save the still image to a jpeg file_capturectrl.SaveStillBitmap(jpgFile, StillFormatType.JPEG444, 9, 0, -1);// stop the capture_capturectrl.StopCapture();// check for the capture file and set the resultif (File.Exists(jpgFile))_result = true;}catch (Exception){_result = false;}}static class LEAD_VARS{public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 20\Media";}
Imports LeadtoolsImports Leadtools.MultimediaImports LeadtoolsMultimediaExamples.FixturesPublic _form As CaptureCtrlForm = New CaptureCtrlForm()Public _capturectrl As CaptureCtrl = NothingPublic _result As Boolean = FalsePublic Sub SaveStillBitmapExample()' reference the capture control_capturectrl = _form.CaptureCtrl' output fileDim jpgFile As String = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_SaveStillBitmap.jpg")Try' select a video capture deviceIf _capturectrl.VideoDevices("USB") Is Nothing ThenThrow New Exception("No USB video device available")End If_capturectrl.VideoDevices("USB").Selected = True' set a video compressor for the capture file_capturectrl.VideoCompressors.Mpeg4.Selected = True' start the capture_capturectrl.StartCapture(CaptureMode.Still)' save the still image to a jpeg file_capturectrl.SaveStillBitmap(jpgFile, StillFormatType.JPEG444, 9, 0, -1)' stop the capture_capturectrl.StopCapture()' check for the capture file and set the resultIf File.Exists(jpgFile) Then_result = TrueEnd IfCatch e1 As Exception_result = FalseEnd TryEnd SubPublic NotInheritable Class LEAD_VARSPublic Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 20\Media"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
