WriteToFile Method of the Image Object
This method saves a copy of the current image plane into an image file in the specified format.
Syntax
Visual Basic .NET
Sub WriteToFile( _ FileName As String, _ Format As ImageFileFormatEnum, _ Modification As ImageModification, _ CompressionType As ImageCompressionTypeEnum, _ extendedParams As Object _ )
C++
HRESULT WriteToFile( BSTR FileName, ImageFileFormatEnum Format, ImageModification* Modification, ImageCompressionTypeEnum CompressionType, IUnknown* extendedParams );
Parameters
- FileName
- [in] This parameter contains the full path to the image file where the image is saved. For example, "C:\MyPic.bmp". If a file in this path already exists, it is overwritten without prompt.
- Format
- [in] A variable of the ImageFileFormatEnum type that specifies the format of the output file. Not all formats defined by this enumeration are supported for writing. Format and CompressionType parameters are related. See the list of supported combinations below.
- Modification
- [in] This parameter of the ImageModification type defines modifications that are performed upon image before writing it into file. This parameter is optional and may be 0, in which case no modifications are performed upon image.
- CompressionType
- [in] A variable of the ImageCompressionTypeEnum type that specifies the compression type of the output file. Format and CompressionType parameters are related. For all image formats except TIFF (IFF_Tif), set this parameter to ICT_Default; compression type will then be selected automatically. See the table below for information about compression types supported for TIFF images.
- extendedParams
- [in] This variable may refer to the JpegExtendedParams or PngExtendedParams object that defines parameters for saving the image to JPEG or PNG format. This parameter is optional and may be 0. In this case the JPEG image is saved with lossless JPEG 2000 compression, or the PNG image is saved with the default parameters.
Return values
This method returns E_INVALIDARG if the saving format is black-and-white while the format of the image is gray or color. It may also return standard return values of ABBYY FlexiCapture SDK functions.
Remarks
The table below describes the possible values of the CompressionType parameter for TIFF images (IFF_Tif). The compression depends on the color type of the saving image (IImage::ImageColorType).
Image color type | CompressionType |
---|---|
Black-and-white image |
ICT_Uncompressed ICT_CcittGroup4 ICT_PackBits ICT_Lzw ICT_Zip |
Color image (ICT_Color), gray image (ICT_Gray) |
ICT_Uncompressed ICT_PackBits ICT_Jpeg ICT_Lzw ICT_Zip |
See also
8/15/2023 1:19:30 PM