Open an image file.
Namespace: Cognex.VisionPro.ImageFileAssembly: Cognex.VisionPro.ImageFile (in Cognex.VisionPro.ImageFile.dll) Version: 80.0.0.0
Syntax
Parameters
- fileName
- Type: System String
The name of the image file to open.
- mode
- Type: Cognex.VisionPro.ImageFile CogImageFileModeConstants
A CogImageFileModeConstants value that indicates that mode in which to open the image file.
Exceptions
| Exception | Condition |
|---|---|
| ArgumentException | mode is not a value. |
| CogFileOpenException | An error occurred while opening the specified file. |
| CogImageFileUnknownImageFileExtensionException | A supplied image file extension was not recognized. |
Remarks
Opens an image file using the image file provider that corresponds to the file's extension. If more than one image file provider supports the extension, the one selected is undefined.
If you do not specify an file open mode, Open(String, CogImageFileModeConstants) defaults to Read .
Examples
Imports Cognex.VisionPro.ImageFile
' Append an image to a file
Dim ImageFile1 As New CogImageFile
ImageFile1.Open("c:\image.bmp", CogImageFileModeConstants.Read)using Cognex.VisionPro.ImageFile; // Append an image to a file CogImageFile ImageFile1= new CogImageFile(); ImageFile1.Open("c:\\image.bmp", CogImageFileModeConstants.Read);
See Also