
| Language: | Visual Basic 6 |
| Version: | 3.0.3 |
| Released on: | April 7, 2005 |
| Author: | IC Imaging Control Support Department |
| Requirements: | IC Imaging Control >2.1 Camera, converter or grabber with WDM Stream Class drivers. |
| |
The following programming example (Visual Basic) shows how you can use IC Imaging Control to grab an image from a device's live image data stream and write it to a JPEG file.
The sample application's window looks as follows:

The program starts by activating a built-in dialog to select a device( .ShowDeviceSettingsDialog). Then the device's live image data stream is displayed using .LiveStart (see image on the right):
Private Sub Form_Load() ICImagingControl1.ShowDeviceSettingsDialog If ICImagingControl1.DeviceValid Then ICImagingControl1.LiveStart Else Unload Me End If End Sub
Now, you are able to access this image: .ImageBuffers.CurrentIndex indicates the position of the last image which has been written into the ring buffer. .ImageBuffers(index) provides an object ImageBuffer containing this image, .SaveAsJpeg writes it into a JPEG file, using the file name and the desired quality (0 to 100) as parameters:
Private Sub cmdSaveJpeg_Click() ICImagingControl1.MemorySnapImage CommonDialog1.DefaultExt = "jpg" CommonDialog1.Filter = "Jpeg Images (*.jpg)|*.jpg|" CommonDialog1.ShowSave If CommonDialog1.FileName <> "" Then Dim currentIdx As Integer currentIdx = ICImagingControl1.ImageBuffers.CurrentIndex Dim buf As ImageBuffer Set buf = ICImagingControl1.ImageBuffers(currentIdx) buf.SaveAsJpeg CommonDialog1.FileName, 75 End If End Sub
Disclaimer
The source code that appears in the IC Imaging Control Source Code Library is indented for educational purposes only. The Imaging Source Europe GmbH, the manufacturer of IC Imaging Control, does not assume any kind of warranty expressed or implied, resulting from the use of the content of this page.